1
Misc Archive / Re: Way to duplicate widget
« on: July 26, 2014, 05:01:40 PM »
Have you tried defining the Example Button GameObject before the loop and using that to remove it?
- int gameId = 0;
- GameObject exampleButton = GameObject.Find ("GameButtonExample")
- foreach (Game game in PlayerInfo.currentGames.games) {
- GameObject nButton = NGUITools.AddChild (GameObject.Find ("ShopGrid"), exampleButton );
- nButton.name = "GameButton"+gameId;
- foreach (UIWidget t in nButton.GetComponentsInChildren<UIWidget>()) {
- if (t.name != "Background")
- t.alpha = 0;
- }
- gameId++;
- }
- Destroy(exampleButton);
