Tasharen Entertainment Forum

Support => NGUI 3 Support => Topic started by: Pip Robbins on February 25, 2013, 02:16:00 AM

Title: Listen for all events
Post by: Pip Robbins on February 25, 2013, 02:16:00 AM
Is there a easy way for multiple scripts to signup to listen to all events?

For instances I have a multiple context sensitive menus which if they click or do anything other then click on a menu item it should disappear.

I know I could make a update function and listen if something else was touched with UICamera, but I try to avoid updates functions where ever possible so its not getting called when not in use, or am I being to stubborn?
Title: Re: Listen for all events
Post by: ArenMook on February 25, 2013, 07:12:38 AM
Best way to do this is to give selection to your context menu when you show it. In a script on that context menu, implement OnSelected (bool isSelected) function, and if isSelected is false, close the context menu. You don't need to listen to all events for this.
Title: Re: Listen for all events
Post by: Pip Robbins on February 25, 2013, 11:10:20 PM
Cheers!

I can't believe I forgot about OnSelect, I'm an idiot!