- Home /
Using EditorSceneManager to make custom level skip editor GUI doesn't work
Hi. I'm trying to make a little window for my editor that will simply allow me to skip between levels nice and quickly. I've got the buttons showing up and everything, but the following code results in the error "ArgumentException: Scene file not found ''. even though there is definitely a scene set up next in the build index. The debug.log prints the current scene perfectly too so I'm kinda at a loss. Thanks in advance for any help
void OnGUI()
{
GUILayout.Label(levelsText, EditorStyles.boldLabel);
if (GUILayout.Button("Next"))
{
Debug.Log(EditorSceneManager.GetSceneByBuildIndex(EditorSceneManager.GetActiveScene().buildIndex).path);
EditorSceneManager.OpenScene(EditorSceneManager.GetSceneByBuildIndex(EditorSceneManager.GetActiveScene().buildIndex + 1).path);
}
}
Your answer
Follow this Question
Related Questions
How to tell if any textField has keyboard focus in editor? 2 Answers
Lining up GUI 1 Answer
How do I get a reference to the default editor windows (Hierarchy, Console, and Inspector)? 1 Answer
Editor GUI Foldout header style customization 0 Answers
EditorGUI, EditorGUILayout, GUI, GUILayout... pshhh... WHEN TO USE WHAT?! 3 Answers