Hello,
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)
{
Application.LoadLevel(levelToLoad);
}
}
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))
{
levelButtonSound.Play();
LoadLevel("Jungle");
}
function LoadLevel(levelToLoad:String)
{
Loading_Manager.levelToLoad = levelToLoad;
Application.LoadLevel("Loading");
}
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 ![]()