Author Topic: Catch all click events not caught elsewhere  (Read 2696 times)

nicolethenerd

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 9
    • View Profile
Catch all click events not caught elsewhere
« on: January 09, 2014, 04:50:11 PM »
I have a setup with two UICameras - one for all of my UI elements, and one for all of the stuff in my game world.  There are clickable elements (with box colliders) both on the UI and in the world.  I now want to catch all click events that aren't already caught by something else - I think I probably need to create a box collider that is "behind" everything, but I am not sure how to do this - I can't put it with my other UI elements, because then it will catch events that were intended for clickable items in my game world, since the UI Camera detects events before the other camera - but I'm not sure how to put a box collider behind my entire game world.  Just make a really big invisible sprite, in every scene? Or is there a better way?

(My use case for this, in case you're curious, is that I have a UI element that toggles a blur effect.  I want the user to be able to click anywhere on the screen to unblur it, with the exception of places that already do something else - those should continue to do whatever they normally do when clicked)

Thanks!

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Catch all click events not caught elsewhere
« Reply #1 on: January 09, 2014, 06:14:34 PM »
Set UICamera.fallThrough to some game object. This object will catch all events that were not handled by your other two cameras.

nicolethenerd

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 9
    • View Profile
Re: Catch all click events not caught elsewhere
« Reply #2 on: January 09, 2014, 09:53:50 PM »
Wow, did not know that was a thing - that sounds perfect, thank you!