Author Topic: Event Receiver  (Read 3637 times)

Rigo

  • Guest
Event Receiver
« on: July 11, 2013, 09:13:40 AM »
Hi All,

I'd be very grateful if someone could help me. I have two nGui cameras in my project, one of them for the screens to click buttons, called Camera_2D and the another one for the scene3D to pick 3d objects. Both of them work well except when I click on a screen and beside this screen there is an object3d in the scene 3d. The result is the Camera_2D detects I click on the screen but at the same time, the Camera_3D detects I click the object3D. I'd like to discard the click on the item, beside the screen. I have tried to set the same Event Receiver Mask to both cameras, but it doesn't work.

Thanks in advance.

Best Regards.

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Event Receiver
« Reply #1 on: July 11, 2013, 07:20:26 PM »
2D should be on 2D layer, 3D should be on 3D layer.

2D camera should only see 2D, 3D camera should only see 3D.

Both camears should have UICamera script attached.

You should be using NGUI events (OnClick, OnPress, etc). Using OnMouse### or Input won't work.

Rigo

  • Guest
Re: Event Receiver
« Reply #2 on: July 12, 2013, 02:21:37 AM »
Thank you ArenMook for your answer.

I have done what you say, but the problem is if there is an open screen (clickable - layer_2d) and behind this screen there is an object in the 3d scene (clickable - layer_3d), both gameObjects, screen and 3d object, receive its own onClick event (one of them from the Camera2d, and the other one from the Camera3d). I'd like not to process the click for the 3d object when the screen is open. The 3d object would know there is another gameobject (the screen) in front of it and not to process its onClick event. Each camera has its own Event Receiver mask.

Thanks!

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Event Receiver
« Reply #3 on: July 12, 2013, 01:27:04 PM »
What you say is not physically possible. Assuming you are talking about NGUI's OnClick() function, the last camera to be drawn is the first one to get the event, and this event will not be processed by the second camera at all.