- Home /
Scene starts before scene loading is finished
So my problem is:
I have a loading screen to switch between scenes. The problem is that the scene starts before the loading screen disappear (music and coroutines).
I´m using this code for the loading screen:
public class ExampleClass : MonoBehaviour {
IEnumerator Start() {
AsyncOperation async = Application.LoadLevelAsync("MyBigLevel");
yield return async;
Debug.Log("Loading complete");
}
}
Thanks in advance for the help!!
What happens if you StartCoroutine from void Start() ins$$anonymous$$d of making Start the coroutine?
Can't you use a bool to check if the loadingscreen is done? And then afterwards load your level? Or is your level too big that it takes seconds to load the scene.
The scene is too small... I think that the iPhone load it faster than the spash screen its done...
Answer by CaKeMeaT · Jul 15, 2015 at 11:44 PM
Async commands will cause your code to branch out right? so you're loading side-by-side to your other code.
I wrote this code in a empty game object in a scene calls "loading" (it is the 0 Scene). Before the splash screen desappear, the music starts and I lose over 1 or 2 seconds of intro...
try without the Async/Ienum and simply use
Application.LoadLevel(" ");