Tasharen Entertainment Forum

Support => NGUI 3 Support => Topic started by: eucryptic on May 09, 2013, 04:26:07 AM

Title: Scene Transition Question
Post by: eucryptic on May 09, 2013, 04:26:07 AM
I'm trying to deal with more advanced animated/fading transitions between scenes.
We have a bunch of scenes, most with NGUI setups.

I've tried some stuff and it seems like a tricky situation.

a) Keep a single NGUI hierarchy between scenes, mark it DontDestroyOnLoad
This would make all scenes other than the first one impossible to play, as they couldn't have NGUI setups present within the .scene file.

b) Add a transition GameObject to the NGUI setup in scene A, fade to black, change scene, then create Another transition GameObject in scene B and add it to the NGUI setup there.
This is tempting, but if we want to do more advanced loading screens with animation, this will not work.

It seems to make a lot more sense to have a single transition object that fades up, stays between scenes, and fades out.

The other problem with this is we'd have to add it to the NGUI hierarchy in scene A, then remove it before the scene unloads, so it doesn't get destroyed,
then add it back to the NGUI hierarchy in scene B.
But it's impossible to tell when a scene loads. Even if you call Application.LoadLevel(sceneName), the line after it doesn't occur after the load.
You'd need some kind of "Find any existing transition objects loose in the scene" script on the NGUI hierarchy, that is activated on OnSceneLoad().
This seems like the best option, but it still Feels wrong.

Ideally I'd have an object that uses DontDestroyOnLoad, and has no parents in the scene hierarchy, but somehow draws over everything.
Is this possible? It seems NGUI stuff draws over Everthing.

Sorry that was a big rambling. I think other people will have simiilar issues with scene transitions, though.
Title: Re: Scene Transition Question
Post by: dlewis on May 09, 2013, 05:02:20 AM
A lot of Unity functions are 1 frame after, load level is one of those.

For our game (which doesn't change scenes much) we build the UI in a different scene (UIFrontEnd, UIInGame) and then do LoadLevelAdditive to add the UI to the game. You might want to check that out.