I’m working on a custom weapon editor that loads a new scene with a selected GameObject , similar to the way the Avatar configuration window creates a new scene with only the Avatar.
public static class EditorUtils {
// Creates a new scene
public static void NewScene () {
EditorApplication.SaveCurrentSceneIfUserWantsTo ();
EditorApplication.NewScene ();
}
// Remove all the elements of the scene
public static void CleanScene () {
GameObject[] allObjects = Object.FindObjectsOfType<GameObject>
();
foreach (GameObject go in allObjects) {
GameObject.DestroyImmediate (go);
}
}
// Creates a new scene capable to be used as a level
public static void NewLevel () {
NewScene ();
CleanScene ();
}
}
}
How do I save the scene name before the new Level is created so that when the user is done they can go back to the original scene before the weapon configuration scene was launched?