Author Topic: NGUI and Game Camera  (Read 1688 times)

Moradom

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 1
  • Posts: 15
    • View Profile
NGUI and Game Camera
« on: December 20, 2013, 01:00:54 PM »
Hello All,

I recently purchased NGUI and I think they did a great job with the workflow!

I am coming from EZGUI, so I wanted to ask this forum a best practices question on NGUI and game cameras. I am designing a new mobile 2D game that will contain different menus and the actually game scene with a few NGUI components (i.e. a pause button). My question is should I make a separate camera just for the NGUI menus and then a separate camera just for the 2D game view? Or is it ok just to use NGUI camera for both?

My game will also need to receive touches from the user and I am not sure if this will cause issues with NGUI. I am looking for any thoughts or advise from people who have done this before.

Thank you,
Eric

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: NGUI and Game Camera
« Reply #1 on: December 21, 2013, 02:31:59 AM »
Game camera will draw the game. UI camera will draw the UI. UI generally stays stationary while the game moves around, which is why the two should use separate cameras.

NGUI has a powerful event system built-in. All you need is to have a UICamera script attached to the camera that draws the object you want to interact with, and a collider on that object. You can then receive OnClick() and other events on it. Check the documentation for the UICamera for a full list.