public override void OnInspectorGUI() { CoreEditorModule.ShowScriptReference(serializedObject); serializedObject.Update(); SceneAsset oldScene = AssetDatabase.LoadAssetAtPath <SceneAsset>(scenePath.stringValue); EditorGUI.BeginChangeCheck(); SceneAsset newScene = EditorGUILayout.ObjectField( "Scene", oldScene, typeof(SceneAsset), false ) as SceneAsset; if (EditorGUI.EndChangeCheck()) { string newPath = AssetDatabase.GetAssetPath(newScene); scenePath.stringValue = newPath; scenePath.serializedObject.ApplyModifiedProperties(); sceneName.stringValue = CoreEditorModule.GetSceneNameFromPath(newPath); sceneName.serializedObject.ApplyModifiedProperties(); if (CoreEditorModule.IsSceneAlreadyInBuild(newPath)) { isEnabled.boolValue = CoreEditorModule.IsSceneEnabled(newPath); } } if (newScene != null) { CoreEditorModule.DrawHorizontalLine(); advanceOption.boolValue = EditorGUILayout.Foldout( advanceOption.boolValue, "Advance Option", true ); if (advanceOption.boolValue) { EditorGUI.indentLevel += 1; EditorGUI.BeginChangeCheck(); EditorGUILayout.PropertyField(animationSpeedForLoadingBar); if (EditorGUI.EndChangeCheck()) { animationSpeedForLoadingBar.serializedObject.ApplyModifiedProperties(); ClampAnimationValue(); } EditorGUILayout.PropertyField(loadSceneMode); EditorGUI.indentLevel -= 1; } CoreEditorModule.DrawHorizontalLine(); EditorGUILayout.BeginHorizontal(); { if (CoreEditorModule.IsSceneAlreadyInBuild(scenePath.stringValue)) { EditorGUI.BeginChangeCheck(); isEnabled.boolValue = EditorGUILayout.Toggle( "IsEnabled", isEnabled.boolValue ); if (EditorGUI.EndChangeCheck()) { isEnabled.serializedObject.ApplyModifiedProperties(); CoreEditorModule.EnableAndDisableScene(scenePath.stringValue, isEnabled.boolValue); } if (GUILayout.Button("LoadScene")) { _reference.LoadScene(); } if (GUILayout.Button("Remove", GUILayout.Width(100))) { CoreEditorModule.RemoveSceneFromBuild(scenePath.stringValue); } } else { EditorGUILayout.HelpBox("Please add scene to the build settings", MessageType.Info); if (GUILayout.Button("Add", GUILayout.Width(100))) { CoreEditorModule.AddSceneToBuild(scenePath.stringValue, isEnabled.boolValue); } } } EditorGUILayout.EndHorizontal(); } serializedObject.ApplyModifiedProperties(); }