Tasharen Entertainment Forum

Support => NGUI 3 Support => Topic started by: tinyutopia on June 16, 2012, 05:31:16 PM

Title: NGUITools.SetActive not updating after made true
Post by: tinyutopia on June 16, 2012, 05:31:16 PM
I have an array of GameObjects that I disable in start with

  1.         void setAllItemsInvisable() {
  2.                 for ( var i = 0; i < 6; i ++ ) {
  3.                         for ( var j = 0; j < 7; j ++ ) {
  4.                                 NGUITools.SetActive(buttonViewableArray[i, j], false);
  5.                         }
  6.                 }
  7.         }

which works well enough. Then I make the GameObject active with

   
  1. public void MakeButttonVisible(int category, int item) {
  2.                 NGUITools.SetActive(buttonViewableArray[category, item], true);
  3.         }

I can see that the GameObject is active, but it does not update in the game view until I click on it and move it around. Is there somewhere else that I should be putting the SetActive method so that it will happen when it's called and not require the playing around to get it to appear?
Title: Re: NGUITools.SetActive not updating after made true
Post by: Nicki on June 16, 2012, 07:31:47 PM
If it's your UIpanel that's not updating, you can try to call Refresh() on it. It's hard to say, because you're not giving us much to go on.

Is it in a draggable panel? Is it in table? Grid? How does the hierarchy look?
Title: Re: NGUITools.SetActive not updating after made true
Post by: ArenMook on June 17, 2012, 06:51:15 PM
Another question to add -- is the panel marked as static (not the game object, the option on the UIPanel).
Title: Re: NGUITools.SetActive not updating after made true
Post by: tinyutopia on June 19, 2012, 07:07:41 PM
Thanks for the responses guys.

ArenMook had the solution, I had static checked in my UIPanel. Unchecking it allowed the panel to update.

So the hierarchy is UI Root (2D) > UIPanel > UIDraggablePanel > UIGrid > UIDragPanelContents

Thanks again.