Tasharen Entertainment Forum
Support => NGUI 3 Support => Topic started by: stevej on March 27, 2014, 11:47:59 PM
-
I have two scenes: SCENE1, SCENE2.
Both scenes have their own UIRoot with a child Camera. The Camera's "Clear Flag" is set to "Depth Only" on both of them.
In the Editor:
When SCENE1 loads up, everything is fine. This is a main menu and I press a button to launch the game in SCENE2. When SCENE2 loads up, this is also fine. The new GUI is displayed.
If I build for MacOS (.app):
When SCENE1 loads up, everything is fine. This is a main menu and I press a button to launch the game in SCENE2. When SCENE2 loads up, I can see the SCENE2 GUI, but I can also still see the SCENE1 GUI.
Any thoughts?
-
The first camera to draw must clear color/skybox, not just depth.
-
Ah.. thanks!
-
I'm curious about what's considered to be best practice.
Say I have 4 scenes:
Global, MainMenu, Loader, Game
Would it be recommended to set up the entire GUI in the Global scene (and make it persistent), and then turn parts off/on when needed - e.g. when loading into other scenes.
OR
Have a separate GUI (i.e. UIRoot and Camera) in each of the main scenes - MainMenu, Loader, Game.
I've always done it the first way - with a single GUI - but found it leads to more messy setup and code.
I was attemping to do things the second way this time around, but I'm now wondering if I hit these camera issues because you're just not supposed to do it that way?
Any advice appreciated.
-
I personally prefer the separate GUI approach as it's cleaner -- each scene has only what it needs. If going with a single GUI, I'd advise making it into a prefab so that you can drag & drop it into any scene easily.
-
I personally prefer the separate GUI approach as it's cleaner -- each scene has only what it needs. If going with a single GUI, I'd advise making it into a prefab so that you can drag & drop it into any scene easily.
Okay - cool. That's what I'm doing in this new game. The single GUI approach isn't bad for a small game, but it was a nightmare in the last RPG...
Thanks again!
-
If you have reusable elements such as an inventory window, just save it as a prefab. Pull in only the prefabs you need into your scene's UI.
-
Sorry - I have to go back to the original topic as I've just added another scene and I'm having issues again.
So...
I have three scenes: MainMenu, Loader, Game. MainMenu loads Loader which then loads Game.
Each has its own UI Root with Camera. Only the Game scene also has a second camera (Main Camera) for the game view - and this camera has a reduced viewport rectangle.
The clear flags are set as:
MainMenu: UI Root\Camera (clears Solid Color)
Loader: UI Root\Camera (clears Solid Color)
Game: UI Root\Camera (clears Depth Only), Main Camera (clears Solid Color)
When I run in the Editor - all good.
When I build and run a MacOS build, I get the following:
MainMenu looks fine.
Loader looks fine (can't see any "left-overs" from MainMenu).
Game GUI looks fine, but I can still see "left-over" GUI from the Loader in the area outside of the Main Camera viewport.
Any thoughts on how to properly set this up? And why it's only a problem in a build and not the Editor?
MAINMENU:
(http://www.stevejarman.com/temp/dp_mainmenu.jpg)
LOADER:
(http://www.stevejarman.com/temp/dp_loader.jpg)
GAME:
(http://www.stevejarman.com/temp/dp_game.jpg)
-
If the main camera is set to clear only a part of the screen, then you will have a problem.