11 [CustomEditor(typeof(HeadsetAdjustment))]
14 private static SceneAsset sceneAsset;
15 private static Object sceneObj;
18 private void OnEnable()
26 sceneObj = EditorGUILayout.ObjectField(
27 new GUIContent(
"Next Scene",
"The name of the scene to load when the user is ready. If left empty, " +
28 "the next scene is loaded as specified in the 'Scenes in Build')"),
42 sceneAsset = GetSceneObject(sceneObj.name);
48 private static SceneAsset GetSceneObject(
string sceneObjectName)
50 if (
string.IsNullOrEmpty(sceneObjectName))
55 foreach (EditorBuildSettingsScene editorScene
in EditorBuildSettings.scenes)
57 if (editorScene.path.IndexOf(sceneObjectName, StringComparison.Ordinal) != -1)
59 return AssetDatabase.LoadAssetAtPath(editorScene.path, typeof(SceneAsset)) as SceneAsset;
63 Debug.LogWarning(
"Scene [" + sceneObjectName +
"] cannot be used. To use this scene add it to the build settings for the project.");