I’m half way thorough the lecture and when using invoke it selects the correct level and sets the enum correctly, however there is no delay regardless of how long I make it.
Edit: Shortly after I posted this I spotted the error. I will leave it up as a monument to y stupidity and to see oif anyone else spots it.
void OnCollisionEnter(Collision collision)
{
switch (collision.gameObject.tag)
{
case "Friendly":
print("OK");
break;
case "Finish":
state = State.Transcending;
Invoke("LoadNextLevel", 1f); //parameterise Time
break;
default:
state = State.Dying;
Invoke("LoadFirstLevel", 10f);
SceneManager.LoadScene(0);
break;
}
}
private void LoadNextLevel()
{
SceneManager.LoadScene(1);
}
private void LoadFirstLevel()
{
SceneManager.LoadScene(0);
}