- Home /
IE Numerator & Application load level
Simple but it's not working
I'm waiting in this scene for three secs and moving to next...
public float timeToWait = 3.0f;
public string myChapter = "0";
void Start()
{
StartCoroutine(Whatever());
}
IEnumerator Whatever()
{
Debug.Log("IE");
yield return new WaitForSeconds(timeToWait);
Debug.Log("Wait4");
Application.LoadLevel(myChapter);
Debug.Log("LOADed");
}
Answer by destructivArts · Dec 21, 2016 at 11:10 PM
Application.LoadLevel is obsolete in Unity 5. At the top of your script, you should state that you want to use SceneManagement:
using UnityEngine.SceneManagement;
And then use the function SceneManager.LoadScene:
SceneManager.LoadScene (myChapter, LoadSceneMode.Single);
Hope this helps!
Though it's obsolete it should still work, so not using it isn't the case.
Answer by Geometrical · Dec 21, 2016 at 11:07 PM
Try putting the following line in the Awake() method:
DontDestroyOnLoad(this.gameObject);
Your answer
![](https://koobas.hobune.stream/wayback/20220612103216im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
wait a second before say path is valid? 2 Answers
Instantiate an object as soon as another object is destroyed 2 Answers
WaitForSeconds stuck 1 Answer
fps calculation with while loop in coroutine 2 Answers
IEnumerator Stalling Or Stopping 2 Answers