Current scene execution stops before next scene is fully loaded!


I have a separate scene named “Loading” , which I load before any “big” scene is loaded.
Of course scene “Loading” is light and almost empty which loads fast.
I want to display cool staff inside this scene and since every time I want the same loading
animation to appear, I preferred to have a separate scene.

Here’s the script that manages the “Loading” scene.

public var backgroundGUI:GUITexture;
public static var levelToLoad:String;

function Start () 
     backgroundGUI.pixelInset.width = Screen.width;
     backgroundGUI.pixelInset.height = Screen.height;

function Update ()
	if(Application.GetStreamProgressForLevel(levelToLoad) == 1)

And here’s the script that Loads this scene:

// of course this if conditional is inside GUI , checking for touch , etc ...
if(button1_guiTexture.HitTest(Input.GetTouch(0).position , mainCamera))

function LoadLevel(levelToLoad:String)
	Loading_Manager.levelToLoad = levelToLoad;

As you see clearly in the code, I change the level name and load the “Loading” scene, which
in turn plays a Background and Loads the appropriate Scene.

What I can’t do is applying any animation or percentage display or anything once
Application.LoadLevel(levelToLoad) is called.

I need a way to keep the Update function running untill the next level fully loads.
Or any other different method that can make this work.

Thank you for your time :slight_smile:

This is only possible with Application.LoadLevelAsync which is a unity pro feature. The normal LoadLevel function blocks until the level is loaded. No frame is drawn during the loading.