Home > OS >  How to create a scene through a script?
How to create a scene through a script?

Time:09-19

In my game, I want to make a level editor, and I need to create a new scene on which this level will be located through a script (for a new level). How to do it and is it possible at all?

CodePudding user response:

You can find this in the Unity Docs: https://docs.unity3d.com/ScriptReference/SceneManagement.SceneManager.CreateScene.html

Scene newScene = SceneManager.CreateScene("My New Scene");

Be sure to include SceneManagement in the top of your class.

using UnityEngine.SceneManagement;
  • Related