Tasharen Entertainment Forum
Support => NGUI 3 Support => Topic started by: tony@shatalmic.com on May 17, 2013, 03:20:20 PM
-
I have an iOS app I am writing using NGUI. It has been working fine. I have my different GUIs in different scenes. Some of the are what I call popup scenes. I load these on top of other scenes by using the LoadLevelAdditive. I remove the "popup" by deleting the root object of the scene.
This works in the Editor and has been working on the iPad I am testing with. It was not working on an iPod touch with iOS 5 on it. It is on older iPod.
I have added a bunch more scenes to the app and now it doesn't work on the iPad either. It is a brand new iPad Touch 4th Gen.
When I Destroy the game object of the popup scene root the textures flicker. I put a script in the scene that would tell me if the object is still in the scene by doing a GameObject.Find() with the name of the root scene object. it is NOT in the scene anymore even though the textures from the scene are still flicker / drawing on the scene.
I didn't have the Development Build option turned on so I turned it on to do some debugging and guess what? Everything works now. If I uncheck it then the problem comes back.
Can someone tell me what they think is going on? I know a dev build will usually put in debug symbols and such. What could it be doing that "fixes" my problem?
-
Flicker generally means that you destroyed the camera, and now nothing is clearing the screen.
-
I am sure I am destroying A camera, but there is still another camera in the scene. To recap I have a UIRoot tree with its camera in it as a UI. I then use LoadSceneAdditive with another UIRoot tree in it which is the "popup".
I then want to go back to the first UI, so I Destroy the UIRoot tree of the "popup". As far as my scripts are concerned that tree is gone, but for some reason the UI is still drawing on the screen. This only happens on iOS, not in the editor. It also used to happen on the older iOS 5 iPod and not on the iPad, but somehow I have added enough other stuff now that it is happening on my brand new iPad with iOS 6.
I can only wonder if it is related to the camera thing you mean, but also is a bug of some kind that is caused by running out of memory or some resource.
Please tell me how to solve it.
-
You shouldn't be loading a second UIRoot... that's just confusing. Instantiate a prefab underneath your existing UI hierarchy using your existing UI camera. Don't load a 2nd scene.
With your current setup you need to make sure that one camera is always drawn after another, and that the camera that remains after deletion actually clears color.
-
We have already invested a bunch of time and code into this architecture. I hope we can make it work. So far changing the Clear Flags seems to work. I didn't realize from all my reading that having more than one UIRoot would be a problem.
If I set the clear flags to Depth Only then it seems to work fine.
Do you see any other problems with having multiple UIRoots?