Author Topic: Disable/Enable Event Handling  (Read 2557 times)

vei

  • Guest
Disable/Enable Event Handling
« 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!

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Disable/Enable Event Handling
« Reply #1 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.

reptilebeats

  • Guest
Re: Disable/Enable Event Handling
« Reply #2 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

vei

  • Guest
Re: Disable/Enable Event Handling
« Reply #3 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!!