Application.isLoadingLevel Deprecation

As of Unity 5.2, Application.isLoadingLevel appears to be deprecated. I’ve used this bool extensively in the editor to ensure that certain internal operations/events do not perform while editor scenes are being loaded as well as while switching to play mode in the editor (which also triggered a scene load).

The solution given by the deprecation warning is as follows :

warning CS0618: UnityEngine.Application.isLoadingLevel is obsolete: This property is deprecated, please use LoadLevelAsync to detect if a specific scene is currently loading.

However, Application.LoadLevelAsync appears to pertain to loadScene operations. Since I am not manually loading any scene, I cannot see how it is applicable. If not Application.isLoadingLevel, what solutions are available to detect when the Unity Editor itself is loading/changing a scene?

U5.2> API
When you are loading use:
SceneManager.LoadAsynLevel instead of Application.loadLevelAsync. This loading is async on other thread vs Main thread compared to Application.loadLevel.
you can use:
AsyncOperation async = Application.LoadLevelAsync(SceneManager.GetActiveScene().buildIndex);
and then instead Application.isLoading use !async.isDone to check.

In Editor as you don’t have control of scene loading, you can instead of check in some loop Applicaiton.isLoading you will check SceneManager.GetActiveScene().isLoaded and use callbacks for loading completion SceneManager.sceneLoadedor change: SceneManager.activeSceneChanged

What a nice documentation… Those guys are shameless. :frowning: :frowning:

Assigned a field by var async = Application.LoadLevelAsync("your scene").

Use async.isDone instead.

I think this might help you:

so this is my solution…

void Awake()

    SceneManager.sceneLoaded += SceneManager_sceneLoaded;
    SceneManager.sceneLoaded += SceneManager_ActiveSceneChanged;

private void SceneManager_sceneLoaded(Scene arg0, LoadSceneMode arg1)

      // set bool that scene is loaded and you can proceed

private void SceneManager_ActiveSceneChanged(Scene arg0, LoadSceneMode arg1)

      // set bool that a scene is not currently active and or is loading

void OnDestroy()

    SceneManager.sceneLoaded -= SceneManager_sceneLoaded;
    SceneManager.sceneLoaded -= SceneManager_ActiveSceneChanged;