Tasharen Entertainment Forum

Support => NGUI 3 Support => Topic started by: vei on July 27, 2012, 05:17:46 AM

Title: Disable/Enable Event Handling
Post by: vei on July 27, 2012, 05:17:46 AM
Hi,

I have a pause functionality in my game. During this pause mode, I create a half-transparent black texture as overlay. Is there any way to disable all the event handling (OnClick, hover, etc) during this pause mode without having to disable the box collider from every single button in the scene?

Something like temporarily disable the raycast until the player resume the game.

Thanks!
Title: Re: Disable/Enable Event Handling
Post by: ArenMook on July 27, 2012, 06:18:31 AM
Add a big collider covering your entire UI. Just add it to your half-transparent black overlay texture.
Title: Re: Disable/Enable Event Handling
Post by: reptilebeats on July 28, 2012, 06:05:40 AM
you know i didn't even think about that, i disable all UIWidgets and colliders from tag, but i suppose it would be better to leave it all their.

for this you could change the guilayer thats being effected, for instance i am always checking on layer 10  1<<10 so you could just change all the pause ui to a different layer like 11 and then just check for touch on either layer. to get rid of the ui i suppose you could just disable the camera used for it, unless they are in the same camera then just disable the culling mask
Title: Re: Disable/Enable Event Handling
Post by: vei on July 29, 2012, 11:23:11 PM
Ah, it works!

I tried this method before, but didn't work. Then I just realized it's because I never set the center's z-axis of the Box Collider and somehow it's behind the button's collider.

Thanks for the help ArenMook, NGUI is superb!!