Author Topic: Enabling Object after disable  (Read 2900 times)

TicTac

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 7
    • View Profile
Enabling Object after disable
« on: October 16, 2013, 10:26:56 AM »
Hello, I'm trying to manage enabling and disabling panels in my UI. So  I am able to disable using:
NGUITools.SetActive(GameObject.FindWithTag("newairlinepanel") as GameObject, false); and also
NGUITools.SetActive(newairlinepanel, false); using a predefined gameobject and dragging it on.

But I cannot enable in the same way. I understand that I need to keep a reference to the panel I am disabling, how do I go about this? Heres my hierarchy, the panels I'm interested in are the children of manager_panel


« Last Edit: October 16, 2013, 10:39:07 AM by TicTac »

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Enabling Object after disable
« Reply #1 on: October 16, 2013, 01:01:41 PM »
Basic Unity scripting question here.
  1. using UnityEngine;
  2.  
  3. public class MyScript : MonoBehaviour
  4. {
  5.     public GameObject airplanePanelGO;
  6.  
  7.     void DoStuff ()
  8.     {
  9.         NGUITools.SetActive(airplanePanelGO, false);
  10.         NGUITools.SetActive(airplanePanelGO, true);
  11.     }
  12. }

TicTac

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 7
    • View Profile
Re: Enabling Object after disable
« Reply #2 on: October 16, 2013, 01:49:33 PM »
I already have this. I want to be able to start the scene with all panels hidden and to do this I have been unchecking the box in the editor on the object for showing/hiding. When I use the NGUITools.SetActive(newairline, true); It won't show it?

briermay

  • Guest
Re: Enabling Object after disable
« Reply #3 on: October 24, 2013, 11:47:39 PM »
from what I understand is the panel manager tool in unity if you unchecka panel to hide it and run your game it becomes PERMANENTLY disabled and mostly is only usable to hide panels while your developing so they don't get in your way.

what I do is like this:

  1. public GameObject LoginWindow;
  2. public GameObject RegisterWindow;

then in my Awake or Start function I simply do this:

  1. NGUITools.SetActive(RegisterWindow, true);
  2. NGUITools.SetActive(LoginWindow, false);