Author Topic: 2 cameras: 2 events?  (Read 1841 times)

Tatanan

  • Jr. Member
  • **
  • Thank You
  • -Given: 11
  • -Receive: 0
  • Posts: 81
    • View Profile
    • Casual Arena
2 cameras: 2 events?
« on: August 31, 2015, 04:28:56 AM »
Let's consider I have 2 cameras with one UI Camera each and each of them showing one Layer.
If I have UI Widget, one below the other, each one on one layer, will I have 2 events when clicked?

In other words, I have:
> UI Root (Layer 1)
>> Camera (Layer 1)
>> Widget (Layer 1)
> UI Root (Layer 2)
>> Camera (Layer 2)
>> Widget (Layer 2)
Both widgets with colliders and listening to the click event.
Will the click dispatch 2 events since the widgets are not on the same layer?
Game developer on Casual Arena.

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: 2 cameras: 2 events?
« Reply #1 on: September 06, 2015, 04:59:41 PM »
You could answer your question just by implementing that UI and clicking on the object.

No, you only get one event on the top-most camera's widget.

Tatanan

  • Jr. Member
  • **
  • Thank You
  • -Given: 11
  • -Receive: 0
  • Posts: 81
    • View Profile
    • Casual Arena
Re: 2 cameras: 2 events?
« Reply #2 on: September 07, 2015, 02:01:40 AM »
Thank you for the answer.
I know I could just try it, and in fact I did it, but still I considered important enough to request an official answer, since there are many examples that suggest one thing but the correct answer is different. I give you one example with NGUI:
If you have a child on a GameObject (without a UI Panel) and this chlid has a different layer that the parent, at first it seems the child keeps its layer, but at some moment, the sprite changes the layer to the one of the parent.
In this example, my experiment could suggest an incorrect answer. This is why I ask when I doubt.
Game developer on Casual Arena.