Author Topic: Camera script attached to Main Camera?  (Read 3386 times)

Waanders

  • Guest
Camera script attached to Main Camera?
« on: August 05, 2013, 06:28:51 PM »
Hi guys, I am a brand new user of this fantastic product, so a real newbie.

So I have project with 2 scenes:
Menu (the main menu)
Scene (the 3d game scene)

I added some Texture Buttons to the Menu scene and they work fine!

I added some Texture Buttons to the Scene scene and they did not work. After browsing the forums and messing around a lot I found a solution.

Solution:

--> for the Scene scene (where the buttons did not work) I checked the UICamera script attached to the Main default camera that was already in my scene. NGUI's UI Root camera does not seem to have an effect.

If i understand correctly, the UICamera script only needs to be enabled with the NGUI camera, right? At least, that's how it works with my Menu scene (that worked from the start).

Please enlighten me, since I would like the project to be clean and efficient without any quick fixes that seem to work.

Thanks!

 

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Camera script attached to Main Camera?
« Reply #1 on: August 05, 2013, 10:57:43 PM »
UICamera is what sends out events. As a rule of thumb, if what your camera sees is supposed to receive NGUI events, then it must have a UICamera attached.

Waanders

  • Guest
Re: Camera script attached to Main Camera?
« Reply #2 on: August 06, 2013, 04:52:11 AM »
Thanks for your reply.

So in this case I would attack UICamera to my original camera, and just leave the Root2D -> Camera without the UICamera script? That is the only way that seems to work for me, but I find it a bit confusing, since the UI is rendered through the NGUI Camera.


ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Camera script attached to Main Camera?
« Reply #3 on: August 07, 2013, 05:41:23 AM »
Assuming you don't want your UI to receive events, yes. If you do, then both should have a UICamera.