Author Topic: Can you have two UI ROOT(2D) and two cameras?  (Read 7555 times)

ProjectOne

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 4
    • View Profile
Can you have two UI ROOT(2D) and two cameras?
« on: February 04, 2013, 11:18:03 PM »
HI,
I am using a UI Root(2D) with NGUI Camera to draw all layers and sprites for an object-layer based parallax scrolling 2D game (seen example from thinkscroller which indeed uses NGUI to draw sprites for such setup)

BUT I was thinking to separate pure UI elements like Score/Timers/Health,etc... to be on a different layer (NGUI layer) and have their own NGUI camera.
At the moment I have a NGUI Label on NGUI layer which is displayed by same camera that displays parallax scene.

Is it ok to create a New UI (from UI tool) which will come with his own UI Root(2D) - Camera - Panel... or is it the case that I can only have one UI Root(2D) in a scene?

Thanks

lime-green.at

  • Jr. Member
  • **
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 60
    • View Profile
Re: Can you have two UI ROOT(2D) and two cameras?
« Reply #1 on: February 05, 2013, 02:55:31 AM »
Yeah, that works pretty well. If you dont need the anchor to clip to two different sides, you can just create a new panel in your already existing UI Root, if not, just duplicate the anchor with all its childs.

Regards

Nicki

  • Global Moderator
  • Hero Member
  • *****
  • Thank You
  • -Given: 33
  • -Receive: 141
  • Posts: 1,768
    • View Profile
Re: Can you have two UI ROOT(2D) and two cameras?
« Reply #2 on: February 05, 2013, 04:05:15 AM »
I don't think you really gain much from making a secondary root, unless of course you want its virtual pixels to be a different size - that can lead to headaches though, so tread carefully. :)

ProjectOne

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 4
    • View Profile
Re: Can you have two UI ROOT(2D) and two cameras?
« Reply #3 on: February 05, 2013, 06:00:32 AM »
Thanks guys...

So maybe best option is to create a new panel under existing UI Root and have a camera with UI Camera just for content of this panel, so I can keep scene sprites and GUI stuff on separate cameras? But with one UI Root

Will try thanks