Unity 5.3 Restarting current scene
Hello, before Unity 5.3, I could do
Application.LoadLevel(Application.loadedLevel);
But now it's something weird with SceneManager. I've read documentation but nothing. How do I get the current scene and load it (Unity 5.3f4)?
Thanks!
Answer by jbecana · Dec 09, 2015 at 10:26 AM
I haven't tried yet, but it should be something like this:
Scene loadedLevel = SceneManager.GetActiveScene ();
SceneManager.LoadScene (loadedLevel.buildIndex);
Thanks it helped, but when it resets the scene, the shading is much darker. However I doubt that will actually happen in the actual build. Thanks.
Answer by GarthLaoshi · Apr 08, 2017 at 08:15 AM
As Kermitt said, but just in one line:
SceneManager.LoadSceneAsync(SceneManager.GetActiveScene().buildIndex);
Tested this on the survival shooter tutorial (the current tutorial uses the obsolete loadlevel code).
Answer by kevinrocks_786 · Dec 09, 2015 at 12:15 PM
@kermitt Thanks it helped, but when it resets the scene, the shading is much darker. However I doubt that will actually happen in the actual build. Thanks.
@kevinrocks_786 what libraries are you importing on the script? $$anonymous$$e doesn't recognize "Scene"
UnityEngine.Scene$$anonymous$$anagement is the namespace. Scene$$anonymous$$anager is the class.
Scenes become darker when reloaded or even if you switch to another within the editor due to a glitch with the Auto Generate Lighting feature. Disable it in your scene's lighting settings and you should be good to go :)
Answer by bekjan_ · Jun 03, 2017 at 11:34 AM
kevinrocks_786 I just have quick question about the shading, is it going to be a problem? I have a similar problem, the scene restarts but shaders go dark, and in my case its really visible and looks bad.
Your answer
Follow this Question
Related Questions
Teleport to next scene 0 Answers
Arduino to Unity 0 Answers
how to change default image of display dialogue box in unity c#? 0 Answers