private static void CreateButton() { if (!tckGUIobj) { CreateTouchManager(); } SetupController <ButtonUgui>(ref Button, tckGUIobj.transform, "Button" + FindObjectsOfType <ButtonUgui>().Length.ToString(), true); ButtonUgui btnTemp = Button.GetComponent <ButtonUgui>(); btnTemp.normalSprite = AssetDatabase.LoadAssetAtPath <Sprite>("Assets/" + nameAbbrev + "/Base/Resources/Sprites/ButtonNormal.png"); btnTemp.pressedSprite = AssetDatabase.LoadAssetAtPath <Sprite>("Assets/" + nameAbbrev + "/Base/Resources/Sprites/ButtonPressed.png"); btnTemp.MyName = Button.name; btnTemp.myData.touchzoneRect.sizeDelta = new Vector2(55f, 55f); Button.transform.localScale = Vector3.one; btnTemp.myData.touchzoneRect.anchoredPosition = RandomPos; }
// OnEnable void OnEnable() { myTarget = ( ButtonUgui )target; EventsHelper.HelperSetup(myTarget); }