- Home /
How to stop loading of a scene that's loading using SceneManager.LoadSceneAsync ?
Use-case scenario:
1) Scene is loading using SceneManager.LoadSceneAsync (loading is not complete yet)
2) Suddenly we need to stop the loading of that scene, so we try to use:
AsyncOperation asyncOperation = SceneManager.UnloadSceneAsync(scenePath);
But the returned asyncOperation is NULL!
Questions:
1) How can we stop loading of a scene?
2) Alternatively, how can we unload a loading scene?
UPDATE1:
Further tests made. Decided to wait for LoadSceneAsync to complete (to avoid the null-return of AsyncOperation), and once it completes, scheduled to start automatic UnloadSceneAsync. That call to UnloadSceneAsync does return non-null AsyncOperation (good part), but the operation (unloading) NEVER finishes (bad part)!
Help Anyone! Is this a Unity bug? Is there are workaround?
Answer by _watcher_ · Jan 24, 2021 at 04:09 PM
Reopened to add link to forum with possible answers (for anyone who finds this in the future): https://forum.unity.com/threads/scenemanager-unloadsceneasync-returns-null.472764/#post-3563384