Author Topic: Using NGUITools.SetActive instead of SetActiveRecursive to toggle Tabs On/Off  (Read 5727 times)

Aneurysm

  • Guest
Hi ArenMook,

I am loving the NGUI plugin, so many wonderful features. I have however come across a small issue that I think you might perhaps improve on?

Namely the lack of an option to disable colliders when using a checkbox to toggle the visibility of an object. I have read another post you answered in which you describe using a collider over the top of some slider panels to interrupt the collision underneath, however in my case, I am using 'tabs' layered directly on top of each other, which are toggled on/off in a radio series of switches. This means that I can't simply place a collider over the top else it will block out all input. I am currently using a solution that just deactivates the parent object for the tab "SetActiveRecursively()" which works well enough in my instance, however the drawback to this method is that I have to use static variables to store instances of the objects into memory in order to recall them once they have been deactivated. Is it possible to implement perhaps a boolean switch into your code that allows the player the option to switch colliders on/off with the UICheckbox/UICheckboxControlledComponent or is there a specific reason you have avoiding doing this?

Edit: Modified the Subject Heading to be more useful for others searching the forums
« Last Edit: May 07, 2012, 11:30:56 PM by Aneurysm »

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: A Suggestion for NGUI
« Reply #1 on: May 07, 2012, 10:33:35 PM »
For the tutorial in Windward, I simply created several pages of text in the same place, by copy/pasting and modifying the same label.

I then have a paging script that contains game object references to all of my pages.

When I say "activate page X", the script runs through all the references and does NGUITools.SetActive(false) on all except the one I want to be active. That one gets NGUITools.SetActive(true).

Aneurysm

  • Guest
Re: A Suggestion for NGUI
« Reply #2 on: May 07, 2012, 11:03:51 PM »
Thanks for the quick response, I see that you are then essentially approaching it in the same manner, only you use your built in class instead (reading the description here) it seems you believe the unity version of SetActiveRecursively to be unstable.
« Last Edit: May 07, 2012, 11:05:29 PM by Aneurysm »

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: A Suggestion for NGUI
« Reply #3 on: May 07, 2012, 11:15:56 PM »
Not unstable, it just activates objects in the wrong order.