Skip to content

Instantly share code, notes, and snippets.

@tsubaki
Created March 23, 2017 16:01
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tsubaki/d60a7ab80ca0bdb8094884dd59b7feb7 to your computer and use it in GitHub Desktop.
Save tsubaki/d60a7ab80ca0bdb8094884dd59b7feb7 to your computer and use it in GitHub Desktop.
using UnityEditor;
using UnityEngine;
using UnityEditor.SceneManagement;
public class Sample
{
static void CreateStage1()
{
EditorSceneManager.NewScene (NewSceneSetup.EmptyScene, NewSceneMode.Single);
var obj = new GameObject ("sample");
obj.AddComponent<Main> ();
EditorSceneManager.SaveScene (EditorSceneManager.GetActiveScene(), "Assets/sample.unity");
EditorBuildSettings.scenes = new[]{ new EditorBuildSettingsScene ("Assets/sample.unity", true) };
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment