UnityEngine.Application.LoadLevel(int) is obsolete

I am getting many errors like the following within my project after upgrading to unity 5.3

The problem is when I try to change it, it comes up with the error

Can someone tell me what im doing wrong because it thinks SceneManager.LoadScene doesn’t exist but its telling me to use it.

What I previously would have done was Application.LoadLevel(2);

4 Likes

Same issues here. Please help!!
here my error:

warning CS0618: UnityEngine.Application.LoadLevel(int)' is obsolete: Use SceneManager.LoadScene’

I changed it and got the same error as OP!

Edit: Also it keeps crashing during testing. I am filing an error report

2 Likes

are you passing “loadscene” it’s parameters, or are you literally using it as above?

1 Like

add
using UnityEngine.SceneManagement;

to the top of your script than use SceneManager.LoadScene(string scenePath)

24 Likes

Thank you. Will do this now. Sorry, I’m still learning. Thank you so much!

1 Like

we all are scenemanager is new in 5.3 :smile:

2 Likes

Ugh. Sounds like its time for me to go read the change log. What else did they break?

7 Likes

You can still use the old OpenScene stuff from Application but it is deprecated in favour of the scene manager

2 Likes

They’ve provided a nice guide outlining all the stuff they’ve broken for us. :stuck_out_tongue:

http://docs.unity3d.com/Manual/UpgradeGuide53.html

Though honestly I felt the guide wasn’t as helpful as the API docs. After I actually found them.

http://docs.unity3d.com/530/Documentation/ScriptReference/SceneManagement.SceneManager.html

6 Likes

Just read through the release notes. Not that much actually broke.

2 Likes

The automatic API updater is a real timer-saver for people who are keeping several versions of a package.

I wonder why they hadn’t added things like Application.LoadLevel() → SceneManager.LoadScene() to the auto-update list, it seems like a simple enough change. I don’t see them in the non-auto-update list either. Did they forget it or something?

1 Like

But how to do this in Java?

In JS you write at the top:

import Unity.SceneManagement

After that you can replace Application.LoadLevel() with SceneManager.LoadScene()

1 Like

Sorry i’m fairly new at this, the import line return me the following error: “BCE0021: Namespace ‘Unity.SceneManagement’ not found, maybe you forgot to add an assembly reference?”.

I guess I did something wrong?

try using UnityEngine.SceneManagement;

Yes I just figured it out at the moment ha ha, thank you very much anyway.

I put it into the code, but I get the error:
UCE0001: ‘;’ expected. Insert a semicolon at the end.

What happens when you put semicolons in all the right places?

import Unity.SceneManagement
#pragma strict


function Start () {

    SceneManager.LoadScene("Continue");
   
}

I’m trying so here. I do not see where you can Postan semicolon.

Semicolons go at the end of statements. Like they always have.

This includes your import statement on line 1

import Unity.SceneManagement;
#pragma strict


function Start () {

    SceneManager.LoadScene("Continue");
  
}