I have three scenes( levels) , and I want to show them one by one, then they can be shown in the last view.
For example,
I want to load level per level with DontDestroyOnLoad too keep some elements :
level 1 : GUI camera (to keep) and some object elements (to keep)
level 2 : other object elements (to keep)
level 3 : remain object elements (to keep)
I use Application.LoadLevel at each Level to load the new one : when the Level X is loading, then load the level X+1 .
The result is that I have all elements in the first and third level shown at last, but I lost all elements in the second level. I don’t known why? Can anybody help me?
The following is my code:
Code:
var levelToLoad : int = 0;
function Awake()
{
while (levelToLoad<=2)
{
if (Application.CanStreamedLevelBeLoaded (levelToLoad))
{
if(Application.GetStreamProgressForLevel (levelToLoad)==1.0)
{
Debug.Log("begin:" + levelToLoad);
Application.LoadLevel (levelToLoad);
Debug.Log("End:" + levelToLoad);
levelToLoad++;
}
}
}
}
here is the log file:
begin:0
UnityEngine.Debug:Log(Object)
End:0
UnityEngine.Debug:Log(Object)
begin:1
UnityEngine.Debug:Log(Object)
End:1
UnityEngine.Debug:Log(Object)
begin:2
UnityEngine.Debug:Log(Object)
End:2
UnityEngine.Debug:Log(Object)
By the way is that the level means a scene?