Author Topic: Listen for all events  (Read 2587 times)

Pip Robbins

  • Guest
Listen for all events
« 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?
« Last Edit: February 25, 2013, 02:19:44 AM by Pip Robbins »

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Listen for all events
« Reply #1 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.

Pip Robbins

  • Guest
Re: Listen for all events
« Reply #2 on: February 25, 2013, 11:10:20 PM »
Cheers!

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