Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - Boogscraft

Pages: [1]
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?
  1. int gameId = 0;
  2. GameObject exampleButton = GameObject.Find ("GameButtonExample")
  3. foreach (Game game in PlayerInfo.currentGames.games) {
  4.       GameObject nButton = NGUITools.AddChild (GameObject.Find ("ShopGrid"), exampleButton );
  5.       nButton.name = "GameButton"+gameId;
  6.       foreach (UIWidget t in nButton.GetComponentsInChildren<UIWidget>()) {
  7.           if (t.name != "Background")
  8.              t.alpha = 0;
  9.       }
  10.       gameId++;
  11. }
  12. Destroy(exampleButton);
  13.  

Pages: [1]