Author Topic: 10+ Cameras under UIRoot  (Read 1868 times)


  • Guest
10+ Cameras under UIRoot
« on: March 21, 2013, 01:30:09 PM »
6 months ago we were new to Unity as well as NGUI.  During our prototyping phase I build quite an extensive UI system.  At that time, I chose to represent each screen such as the in-game gui, the main menu gui, etc... grouped under their own camera under the 2D Root node.  Also at that time, I knew that only one camera would be displayed at a time based on the current game state. 

I'm well aware of UIPanel and UIWidget performance characteristics in terms of moving widgets and using multiple panels.  I've taken care to organize panels and widgets optimally but today had the sudden realization, that perhaps I should have just had one camera and many, many panels underneath it.

Performance-wise we run well for our situation, but I do see heavier UIPanel LateUpdate() and UIAnchor Update() times than I would like.. each taking around 5% of the total profiler time. Not horrible but I can't help but wonder - is it worth going back to consolidate all my cameras into one?  Not a trivial effort but I'm willing to do the work if someone with more experience can shed some advice on having so many cameras (remembering that I only ever display one at a time, others are disabled).  For example, are these cameras creating their own render target textures?!  :o

Thanks a bunch.


  • Sr. Member
  • ****
  • Thank You
  • -Given: 8
  • -Receive: 4
  • Posts: 352
    • View Profile
Re: 10+ Cameras under UIRoot
« Reply #1 on: March 21, 2013, 02:49:22 PM »
You can use just one, at least you want 3D things, clipping cameras or a camera with a different property it should be the same. Just check out are all in the same layer.


  • Global Moderator
  • Hero Member
  • *****
  • Thank You
  • -Given: 33
  • -Receive: 141
  • Posts: 1,768
    • View Profile
Re: 10+ Cameras under UIRoot
« Reply #2 on: March 21, 2013, 06:01:40 PM »
It should not make a huge difference whether you have one camera or a hundred of them, when you always only have a single camera active at any time. The standard approach is to just use one though, since there's not reason to have multiple.

UIpanel.lateupdate and UIAnchor.update would still run the same.

UIAnchor doesn't need to set the position each update though, so once the position has been set correctly, you can disable the component and save those 5 % subsequently.