Question by
lassade · Mar 23, 2016 at 10:05 PM ·
scenescene-switchingscene loadscene change
Trouble set the scene active with SceneMananger
I'm trying to set an scene active that was loaded additively but for some reason i cant get to turn active.
SceneManager.LoadScene(sceneName, LoadSceneMode.Additive);
var scene = SceneManager.GetSceneByName(sceneName);
SceneManager.SetActiveScene(scene); // does not set active
My Unity version is 5.3.4f1.
Comment
Best Answer
Answer by lassade · Mar 23, 2016 at 10:23 PM
My solution was converting the function to a coroutine and then call the SceneManager.LoadSceneAsync method, then wait the load to finish before set the scene active.
var loading = SceneManager.LoadSceneAsync(sceneName, LoadSceneMode.Additive);
yield return loading;
var scene = SceneManager.GetSceneByName(sceneName);
SceneManager.SetActiveScene(scene);
I guess this is a bug, but i am not sure.
$$anonymous$$ore about in this thread http://forum.unity3d.com/threads/scenemanager-loadscene-additive-and-set-active.380826/
Your answer
Follow this Question
Related Questions
Keeping track of the previous scene 1 Answer
How's my SceneManager? 0 Answers
Start function not called after reloading scene 0 Answers
How I can Open a Previous Scene with button back !? 3 Answers