Delay while switching scenes

Hi Friends

Had a query,

I have multiple scenes in my game, While switching between these scenes there is a delay as the objects of the previous scene are getting destroyed new scene is getting loaded.Is there a way I can reduce the delay that is seen while the scenes are switched or can I show a loading screen during the delay to notify the user that the scene is still loading?

Also there a function called “Application.PerloadLevel()”

There is no documentation for the same can any explain the same.

thankyou

You cannot pre-load another level, although you can have something from a previous level remain persistent, something like a “loading” screen/display of sorts. Check out dontDestroyOnLoad as it can be use to make something stay persistent across level loads and so you might use it to create some sort of loading type display to help smooth the loading experience a bit. Alternatively you might look at LoadLevelAdditive to load the new level items additively, saving the time of destruction in that process. Note that you’d likely want to manually unload the objects from the prior level but you can write your own routine that interleaves that once the new scene is loaded to avoid the loading “hiccup” you’re currently experiencing.

Perhaps others will chime in too! :slight_smile:

I just display a loading screen in the scene I’m coming from that stays up until the new scene is loaded. Thank goodness we don’t have the TCR forcing a moving part during a load. Maybe when we eventually get threads we will, but until then, a static screen is the easiest. Unless you want to do something more cinematic like fades.

I knew I forgot something! The golden ticket, we do have threaded loading already…

LoadLevelAsync

GOLD! :smile:

There you go. You can actually have a trigger volume or some other event to kick off the async load earlier as your player nears the transition point or is near completing the current level. Finish the level and play a loading animation checking the isDone flag and then begin the next level. What I do like about this technique is that it uses something we have been doing for consoles for years and that it linear loads the levels if it follows the same sequence as the build settings.

There is no async loading on the iphone, so thats no problem.

Async Loading is a Unity Pro - Desktop only feature

Both of those are excellent points to bring up, I guess I got too excited in my “oh dang, I forgot LoadLevelAsync!” craze. :slight_smile: Thanks for mentioning those limitations for clarity!