Question by
Iplaydev1 · May 16, 2016 at 12:30 AM ·
scene-switchingscenes
Create a Scene and load it
I would like to know if you could create a scene and load it. I am currently trying to create a script that has a function that creates a new scene and loads it with LoadScene() or something.
Comment
Answer by vittu1994 · May 16, 2016 at 04:07 PM
With the new SceneManager class this is possible.
In your script, type this at the top:
using UnityEngine.SceneManagement;
To create a scene and give it a name:
SceneManager.CreateScene("yourSceneName");
To load it:
SceneManager.LoadScene("yourSceneName");
Answer by Jacky2611 · May 16, 2016 at 07:28 PM
And make sure that you include your scene in your build Settings. That drove me nuts once.