Author Topic: Overlapping UIs - Forwarding Touches  (Read 3038 times)

doggan

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 13
    • View Profile
Overlapping UIs - Forwarding Touches
« on: March 02, 2014, 11:12:21 AM »
Hello.

I have two 2-D UIs in my scene - one in the foreground and one in the background. Both have their own camera, with the foreground camera depth being greater than the background camera depth.

The foreground UI has many different invisible buttons on it that take up the entire screen. Depending on which area the screen is clicked, different sounds play.

The background UI has other moving, visible widgets on it that react differently when clicked.

The problem I have is that the foreground UI intercepts all of the touch events, and the background UI will not receive any. What is the best way to 'forward' the touch event to the background UI camera so that it can handle the event as well?

Thank you!

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Overlapping UIs - Forwarding Touches
« Reply #1 on: March 02, 2014, 08:56:39 PM »
You want both to receive events? That seems a bit odd to me, but you can set up your code so that you use the UICamera.genericEventHandler -- this object will receive a copy of all the events whether they were handled or not. In general you only need one set of colliders. You can even do it so that you have no colliders at all if you set either the genericEventHandler or the UICamera.fallThrough.