Author Topic: NGUITools.SetActive makes panel inactive but still visible.  (Read 5134 times)

ferretnt

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 23
    • View Profile
NGUITools.SetActive makes panel inactive but still visible.
« on: August 26, 2012, 12:20:40 PM »
I have two panels, A and B, and I'm switching between them using a simple NGUITools.SetActive() call, like here:

    http://www.tasharen.com/forum/index.php?topic=188.0

This seems to activate/deactivate the two screens (panels) correctly, but doesn't stop them rendering. So as soon as I switch menu the first time, I have both visible, but only one selectable at a time.

What obvious thing am I doing wrong?

Rafe

  • Jr. Member
  • **
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 78
    • View Profile
Re: NGUITools.SetActive makes panel inactive but still visible.
« Reply #1 on: August 26, 2012, 02:59:26 PM »
'm using this a lot in our project without an issue. My understanding is that it is just a safer (ordered) version of Unity's SetActiveRecursively. You might try that and see if you have the same problem:
http://docs.unity3d.com/Documentation/ScriptReference/GameObject.SetActiveRecursively.html

An interesting side-note. In Unity 4 this won't be needed anymore because Unity will manage child objects automatically when the parent is deactivated. I have my fingers crossed that the child state is kept so when the parent is toggled the child could stay hidden if it was to begin with. The new API suggests this will be true. it sounds like there are two functions to replace gameObject.active; one to test the current state and another to test the gameobject's local state.

ferretnt

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 23
    • View Profile
Re: NGUITools.SetActive makes panel inactive but still visible.
« Reply #2 on: August 26, 2012, 05:04:21 PM »
Aha...

Or I *could* be that I was working in my UITestBed, which *doesn't have an extra game camera*, and the UICamera's clear flags are set to depth-only so nothing is actually clearing the backbuffer. So the objects appear to still be there.

Oops. Sorry. Noticed everything worked correctly when I integrated into my main game!