- Home /
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)...
Answer by DaveA · Oct 14, 2011 at 05:50 PM
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/Scene$$anonymous$$anagement.EditorScene$$anonymous$$anager.NewScene.html
Your answer
Follow this Question
Related Questions
3d mouse support in editor? 1 Answer
What is the proper way to draw previews for custom assets 2 Answers
Public Scene Variables not appearing in the inspector 2 Answers
Is there a way to iterate all Scenes in a project and running some code for each of them? 1 Answer
Prevent selection of sub-object 1 Answer