protected virtual void OnEnable() { this.scenesSource = (ScenesSource)EditorPrefs.GetInt("SceneSwitcher.scenesSource", (int)ScenesSource.Assets); this.openSceneMode = (OpenSceneMode)EditorPrefs.GetInt( "SceneSwitcher.openSceneMode", (int)OpenSceneMode.Single); }
private void OnEnable() { scenesSource = (ScenesSource)EditorPrefs.GetInt("SceneSwitcher.scenesSource", (int)ScenesSource.Assets); openSceneMode = (OpenSceneMode)EditorPrefs.GetInt("SceneSwitcher.openSceneMode", (int)OpenSceneMode.Single); ResetData(); LoadScenesData(); SaveScenesFromAssets(); }
protected virtual void SettingsTabGUI() { this.scenesSource = (ScenesSource)EditorGUILayout.EnumPopup("Scenes Source", this.scenesSource); if (this.scenesSource == ScenesSource.Manual) { this.searchFolder = EditorGUILayout.TextField("Search Folder", this.searchFolder); } this.newSceneSetup = (NewSceneSetup)EditorGUILayout.EnumPopup("New Scene Setup", this.newSceneSetup); this.newSceneMode = (NewSceneMode)EditorGUILayout.EnumPopup("New Scene Mode", this.newSceneMode); this.openSceneMode = (OpenSceneMode)EditorGUILayout.EnumPopup("Open Scene Mode", this.openSceneMode); this.showPath = EditorGUILayout.Toggle("Show Path", this.showPath); this.showAddToBuild = EditorGUILayout.Toggle("Show Add To Build", this.showAddToBuild); this.askBeforeDelete = EditorGUILayout.Toggle("Ask Before Delete", this.askBeforeDelete); }
protected virtual void OnGUI() { List <EditorBuildSettingsScene> buildScenes = new List <EditorBuildSettingsScene>(EditorBuildSettings.scenes); this.scenesSource = (ScenesSource)EditorGUILayout.EnumPopup("Scenes Source", this.scenesSource); this.openSceneMode = (OpenSceneMode)EditorGUILayout.EnumPopup("Open Scene Mode", this.openSceneMode); GUILayout.Label("Scenes", EditorStyles.boldLabel); string[] guids = AssetDatabase.FindAssets("t:Scene"); this.scrollPosition = EditorGUILayout.BeginScrollView(this.scrollPosition); EditorGUILayout.BeginVertical(); for (int i = 0; i < guids.Length; i++) { string path = AssetDatabase.GUIDToAssetPath(guids[i]); SceneAsset sceneAsset = AssetDatabase.LoadAssetAtPath <SceneAsset>(path); EditorBuildSettingsScene buildScene = buildScenes.Find((editorBuildScene) => { return(editorBuildScene.path == path); }); Scene scene = SceneManager.GetSceneByPath(path); bool isOpen = scene.IsValid() && scene.isLoaded; GUI.enabled = !isOpen; if (this.scenesSource == ScenesSource.Assets) { if (GUILayout.Button(sceneAsset.name)) { Open(path); } } else { if (buildScene != null) { if (GUILayout.Button(sceneAsset.name)) { Open(path); } } } GUI.enabled = true; } if (GUILayout.Button("Create New Scene")) { Scene newScene = EditorSceneManager.NewScene(NewSceneSetup.DefaultGameObjects, NewSceneMode.Single); EditorSceneManager.SaveScene(newScene); } EditorGUILayout.EndVertical(); EditorGUILayout.EndScrollView(); }
protected virtual void OnEnable() { EditorApplication.playModeStateChanged += PlayModeStateChanged; this.scenesSource = (ScenesSource)EditorPrefs.GetInt( "SceneManager.scenesSource", (int)ScenesSource.BuildSettings); this.searchFolder = EditorPrefs.GetString("SceneManager.searchFolder", "Assets"); this.newSceneSetup = (NewSceneSetup)EditorPrefs.GetInt( "SceneManager.newSceneSetup", (int)NewSceneSetup.DefaultGameObjects); this.newSceneMode = (NewSceneMode)EditorPrefs.GetInt("SceneManager.newSceneMode", (int)NewSceneMode.Single); this.openSceneMode = (OpenSceneMode)EditorPrefs.GetInt( "SceneManager.openSceneMode", (int)OpenSceneMode.Single); this.showPath = EditorPrefs.GetBool("SceneManager.showPath", false); this.showAddToBuild = EditorPrefs.GetBool("SceneManager.showAddToBuild", true); this.askBeforeDelete = EditorPrefs.GetBool("SceneManager.askBeforeDelete", true); }
private void OnGUI() { scenesSource = (ScenesSource)EditorGUILayout.EnumPopup("Scenes Source", scenesSource); openSceneMode = (OpenSceneMode)EditorGUILayout.EnumPopup("Open Scene Mode", openSceneMode); GUILayout.Space(5f); if (GUILayout.Button("Refresh", GUILayout.Width(150f))) { Refresh(); } GUILayout.Label("Scenes", EditorStyles.boldLabel); float width = EditorGUIUtility.currentViewWidth; EditorGUILayout.BeginHorizontal(); scrollPosition = EditorGUILayout.BeginScrollView(scrollPosition, true, true, GUIStyle.none, "verticalscrollbar", GUIStyle.none); EditorGUILayout.BeginVertical(GUILayout.MaxWidth(width / 1.06f)); DrawAssetsButtons(assetsNamesList); EditorGUILayout.EndVertical(); EditorGUILayout.EndScrollView(); EditorGUILayout.EndHorizontal(); GUILayout.Space(20f); if (GUILayout.Button("Create New Scene")) { CreateNewScene(); GUIUtility.ExitGUI(); } GUILayout.Space(20f); GUILayout.FlexibleSpace(); GUILayout.Label("Made with ❤ by GameRig", EditorStyles.centeredGreyMiniLabel); }
protected virtual void SettingsTabGUI() { this.scenesSource = (ScenesSource)EditorGUILayout.EnumPopup("Scenes Source", this.scenesSource); this.openSceneMode = (OpenSceneMode)EditorGUILayout.EnumPopup("Open Scene Mode", this.openSceneMode); }