Tasharen Entertainment Forum

Support => NGUI 3 Support => Topic started by: realblues on May 01, 2012, 08:04:40 AM

Title: collider not disabled when disable UIPanel
Post by: realblues on May 01, 2012, 08:04:40 AM
My Panel has several widgets like button, Inputs..

and several Panel exists in same position, it's visible only one Panel by situation.

to hide it, i use UIPanel.enabled, then images hide but collider still enabled, so new widgets not triggering well.

isn't it right way? should i use NGUITools.SetActive()?
Title: Re: collider not disabled when disable UIPanel
Post by: ArenMook on May 01, 2012, 08:05:16 AM
Yeah, use NGUITools method. It will hide all children as well.
Title: Re: collider not disabled when disable UIPanel
Post by: realblues on May 01, 2012, 08:15:59 AM
Thanks for Quick reply :)
Title: Re: collider not disabled when disable UIPanel
Post by: Nicki on May 01, 2012, 09:06:32 AM
Or use SetActiveRecursively(gameObject, true/false).

Difference with NGUITools.SetActive is that the NGUI version affects parents first, and the built in affects children first.
Title: Re: collider not disabled when disable UIPanel
Post by: ArenMook on May 01, 2012, 09:08:36 AM
Depends on whether it's 'true' or 'false', Nicki. When enabling, parents are enabled before children. When disabling, children are disabled before parents.

Unity's built-in version doesn't do this, and always enables and disables in the same order, which can produce some odd effects.
Title: Re: collider not disabled when disable UIPanel
Post by: Nicki on May 01, 2012, 10:04:05 AM
Ah, I did not know that you change the order based on that.

Nonetheless, both can produce odd effects when you don't know (or expect) the behavior of it. :D