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