public UnityButton Clone(string name, Vector3 posOffset){ UnityButton newBut=new UnityButton(); newBut.rootObj=(GameObject)MonoBehaviour.Instantiate(rootObj); newBut.rootObj.name=name;//=="" ? srcObj.name+"(Clone)" : name; newBut.Init(); newBut.rootT.SetParent(rootT.parent); newBut.rootT.localPosition=rootT.localPosition+posOffset; newBut.rootT.localScale=new Vector3(1, 1, 1); return newBut; }
public UnityButton Clone(string name, Vector3 posOffset) { UnityButton newBut = new UnityButton(); newBut.rootObj = (GameObject)MonoBehaviour.Instantiate(rootObj); newBut.rootObj.name = name; //=="" ? srcObj.name+"(Clone)" : name; newBut.Init(); newBut.rootT.SetParent(rootT.parent); newBut.rootT.localPosition = rootT.localPosition + posOffset; newBut.rootT.localScale = new Vector3(2, 2, 2); return(newBut); }