- Home /
Asynchronously Load a Scene, then switch to it on function call Unity 5.3
I made a game back before Unity 5.3 that used Application.LoadLevelAsync, which is now deprecated. I am trying to achieve the same result: on a startup menu, load a scene asynchronously in the background, and then switch to it on a button press. I've tried SceneManager.LoadSceneAsync("level1", LoadSceneMode.Single);
, but it just switches to the scene once it's done loading. It doesn't seem to behave any differently than SceneManager.LoadScene()
.
My code that runs SceneManager.SetActiveScene(SceneManager.GetSceneByName("level1"));
is never called, so I'm not sure why it's switching to the level1 scene once it's done asynchronously loading.
Any ideas?
Edit: It does not work in both the editor and a standalone web player or built for Windows.
Just make sure you have Unity PRO first since asynchronous loading is a pro feature.
@jebemti Did it used to be free back in Unity 4? But thanks, that was my problem, I am using Unity free version.
Answer by Rob2309 · Mar 23, 2016 at 02:03 PM
var operation = SceneManager.LoadSceneAsync("level1", LoadSceneMode.Single);
operation.allowSceneActivation = false;
This should stop the Scene from being activated right away.
Your answer
Follow this Question
Related Questions
SceneManager onActiveSceneChange Pause for a while before loading a new scene 0 Answers
AsyncOperation activating immediately even with async.allowSceneActivation = false; 0 Answers
AsyncOperation "studders" next scene load and Scene speed problem 0 Answers