Author Topic: How to click on NGUI UI but not trigger the events of the scene?  (Read 1759 times)

Tomleung

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 44
    • View Profile
How to click on NGUI UI but not trigger the events of the scene?

It is because I have some touch events on the gameobjects in the scene, if I click on NGUI, if would trigger the scene events too.

How to avoid it?

Thx.

Darkmax

  • Jr. Member
  • **
  • Thank You
  • -Given: 2
  • -Receive: 1
  • Posts: 93
    • View Profile
Re: How to click on NGUI UI but not trigger the events of the scene?
« Reply #1 on: May 27, 2014, 12:45:18 PM »
If you want that ngui doesn't catch the events you can disable the component UICamera, this will not trigger any event of ngui

Tomleung

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 44
    • View Profile
Re: How to click on NGUI UI but not trigger the events of the scene?
« Reply #2 on: May 28, 2014, 03:22:55 AM »
If you want that ngui doesn't catch the events you can disable the component UICamera, this will not trigger any event of ngui

No, I mean how to avoid trigger the other events but still trigger the UI ?

If I have a cube in the scene, and if I click it, it would destroy.
However, now if the cube and the UI is overlapping and if I click on the UI, it would also destroy the cube too so I need to avoid it.

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: How to click on NGUI UI but not trigger the events of the scene?
« Reply #3 on: May 28, 2014, 06:36:24 AM »
You need to use NGUI events all the way, not check your own Input.Get keys yourself. Check the documentation page for the UICamera. You will need a UICamera script on your main camera as well.