Create a new scene from editor script

Is there a way to create a new scene (on disk) and configure it from an editor script?

I want to make a button that will create and configure a level (in a particular place on disk, and with some default objects in it). I know I could probably make a prefab with the objects I need, and then just have others make the scene and drop the prefab in, but there’s some stuff I’d like to configure (positioning some objects in the correct location and setting some script parameters)…

1 Answer

1

http://unity3d.com/support/documentation/ScriptReference/EditorApplication.NewScene.html

Then run whatever other Editor scripts you like to build it out.

Then http://unity3d.com/support/documentation/ScriptReference/EditorApplication.SaveScene.html

Is this possible to do from a non-editor script too? I want to use this for my world generator, but it has to run while the game is running, and not from the editor...

EditorApplication.NewScene is now obsolete, new method - https://docs.unity3d.com/ScriptReference/SceneManagement.EditorSceneManager.NewScene.html

links are dead