SceneManager.LoadScene works when it wants to???

Ok so I’m having this issue where my script decides on some days that it wants to work and on others it decides it doesn’t.

SceneManager.LoadScene

Apparently the definition LoadScene doesn’t exist.
I literally had this working yesterday, it stopped working. I walked away from it. It decided to work again without any changes. And now it’s done the same to me today.

Why would it keep changing it’s mind?

Have you included the namespace it occupies?

using UnityEngine.SceneManagement;

Yep. I just had one script work. I copied and pasted the code and that one also did not recognise the definition.
Is this a bug or something? Does anyone else suffer from this.

It should be:

SceneManager.Loadscene ("loadLevel");

With the (" ")


Yep… I’m going insane -_-

Try

UnityEngine.SceneManagement.SceneManager.LoadScene("loadLevel");

So I tried that, it didn’t work.

I just recopied and pasted my script. The script that didn’t work… and now it works?

I have I just got bug city running through my Unity?

Try

UnityEngine.SceneManagement.SceneManager.LoadScene("loadLevel");

Weird. If this happens again click the “Clean All” and “Rebuild All” button in MonoDevelop.

1 Like