Author Topic: NGUITools.SetActive not updating after made true  (Read 6938 times)

tinyutopia

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 15
    • View Profile
NGUITools.SetActive not updating after made true
« 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?

Nicki

  • Global Moderator
  • Hero Member
  • *****
  • Thank You
  • -Given: 33
  • -Receive: 141
  • Posts: 1,768
    • View Profile
Re: NGUITools.SetActive not updating after made true
« Reply #1 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?

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: NGUITools.SetActive not updating after made true
« Reply #2 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).

tinyutopia

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 15
    • View Profile
Re: NGUITools.SetActive not updating after made true
« Reply #3 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.