Author Topic: triggering NGUI events from other cameras  (Read 1877 times)

leathers

  • Guest
triggering NGUI events from other cameras
« on: October 09, 2013, 02:34:14 PM »
Hello. I have set up an NGI interface and it works well, as long as it is accessible in any view of my game world. But I also want to be able to trigger an NGUI panel to animate onto screen, by clicking on specific objects in the game world. I can't seem to get that to happen.

I'll describe it more specifically.

- can do - create a 2D ngui interface button, named "map button" that sits on top of a 3D scene
- can do - create an ngui panel named "map panel", that animates onto screen when "map button" is clicked.
- can do - put a box collider on an element names "hidden button" in the 3D scene
- can do - use Debug.Log to make sure that "hidden button" is detecting clicks.. it is..
- CAN NOT DO - trigger "map panel" to animate onto screen when  "hidden button is clicked"

"map button" and "map panel" are both on layer "nguiLayer", along with the camera containing the UICamera.cs. I've tried a few different things, but nothing really worked. I'd prefer to be able to use the playAnimation.cs script to make this happen if possible as I do with "map button".

Not sure if I should be creating another ngui camera and parenting it to my default camera? Thanks for any help.

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: triggering NGUI events from other cameras
« Reply #1 on: October 10, 2013, 07:41:12 AM »
You need a UICamera on every camera that is supposed to send out NGUI events.

This means your Main Camera needs a UICamera on it, not just your UI camera.

Watch the NGUI 3 tutorial video, it explains everything quite well.