Loading/unloading a background-loaded level manually using LoadLevelAsync() (Possible?)


To reduce the loading time in-between scenes, I decided to load (or at least start loading) the next level in the background, before switching the scenes. I’ve been browsing the documentation for Application and found Application.LoadLevelAsync, which seems like a perfect way for loading scenes while the game is still running.

Now, I would like to keep the level loaded in the background, and switch scenes at the appropriate time or event, or cancel the loaded/loading level if the player decides to move back into the level.

Is it possible to do that? Could this be done in any existing function at all? If You can think of anything, please let me know.


You can prevent the new scene starting by using a bool allowSceneActivation. You can then set that to true whenever you want to activate the scene.

However, you cannot cancel this load in any way, as that actually crashes your game (and even the editor).
Also remember to call this function only once, as someone else had a crash because he accidentally called it multiple times in a touch event.