diff --git a/Editor.meta b/Editor.meta deleted file mode 100644 index 932cdff..0000000 --- a/Editor.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: bdf788079ec6c4ebab993c8e0799a934 -folderAsset: yes -DefaultImporter: - externalObjects: {} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Editor/SceneSwitcher.meta b/Editor/SceneSwitcher.meta deleted file mode 100644 index 77c7dbd..0000000 --- a/Editor/SceneSwitcher.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: e93ebd9d7818e4e3481b0c509011bd07 -folderAsset: yes -DefaultImporter: - externalObjects: {} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Editor/SceneSwitcher/AssetChangeListener.cs b/Editor/SceneSwitcher/AssetChangeListener.cs new file mode 100644 index 0000000..8b53543 --- /dev/null +++ b/Editor/SceneSwitcher/AssetChangeListener.cs @@ -0,0 +1,19 @@ +using System; +using UnityEditor; + +namespace RimuruDevUtils.SceneSwitcher +{ + public class AssetChangeListener : AssetPostprocessor + { + public static event Action AssetsWereChanged; + + private static void OnPostprocessAllAssets(string[] importedAssets, string[] deletedAssets, string[] movedAssets, + string[] movedFromAssetPaths) + { + if (importedAssets.Length != 0 || deletedAssets.Length != 0) + { + AssetsWereChanged?.Invoke(); + } + } + } +} \ No newline at end of file diff --git a/Editor/SceneSwitcher/SceneSwitcher.cs b/Editor/SceneSwitcher/SceneSwitcher.cs index 83b3a72..9349124 100644 --- a/Editor/SceneSwitcher/SceneSwitcher.cs +++ b/Editor/SceneSwitcher/SceneSwitcher.cs @@ -1,113 +1,299 @@ // **************************************************************** // // // Copyright (c) RimuruDev. All rights reserved. -// Contact me: +// Contact me: // - Gmail: rimuru.dev@gmail.com // - LinkedIn: https://www.linkedin.com/in/rimuru/ // - Gists: https://gist.github.com/RimuruDev/af759ce6d9768a38f6838d8b7cc94fc8 // - GitHub: https://github.com/RimuruDev +// - GitHub Organizations: https://github.com/Rimuru-Dev // // **************************************************************** // -#if UNITY_EDITOR +using System; +using System.Collections.Generic; using System.IO; +using System.Linq; using UnityEditor; -using UnityEngine; using UnityEditor.SceneManagement; +using UnityEngine; -namespace AbyssMoth.External.RimuruDevUtils.Editor.SceneSwitcher +namespace RimuruDevUtils.SceneSwitcher { public sealed class SceneSwitcher : EditorWindow { - private const string CtrlF2 = "%#F2"; - private const string FindAssets = "t:Scene"; - private const string logFormat = "{0}"; - - private bool showAllScenes; - private bool autoSaveEnabled = true; - private bool settingsFoldout = true; - private bool showDebugLog; - private bool compactButtons; - private Vector2 scrollPosition; - - [MenuItem("RimuruDev Tools/Scene Switcher " + CtrlF2)] + private const string SETTINGS_STORAGE_PATH = "Assets/Editor/SceneSwitcher/SceneSwitcherSettings.asset"; + private const string SCENE_NAME_PLACE = "SCENE_NAME"; + + private const string EXIT_PLAY_MODE = "Exit Play Mode"; + private const string RETURN_TO_PREVIOUS_BUTTON = " <- |Return| <- "; + private const string SETTINGS_BUTTON = "Open Settings"; + private const string ENABLE_CUSTOM_PLAY_MODE_START_SCENE = " Enable Custom Play Mode Start Scene"; + private const string DISABLE_CUSTOM_PLAY_MODE_START_SCENE = "Disable Custom Play Mode Start Scene"; + + private string[] scenes; + private string CurrentScene => EditorSceneManager.GetActiveScene().path; + private string Previous; + + private SceneAsset customPlayModeStartScene; + private string customPlayModeStartScenePath; + + private Settings CurrentSettings => settingsAsset.Settings; + private SceneSwitcherSettingsScriptableObject settingsAsset; + + [MenuItem("Tools/Scene Switcher")] private static void ShowWindow() { - GetWindow(); + GetWindow(typeof(SceneSwitcher)); + } + + private void Awake() + { + if (!LoadSettings()) + { + CreateNewSettingsAsset(); + LoadSettings(); + } + + CollectScenes(); } - private void OnGUI() + private void OnEnable() { - GUILayout.Label("Scene Switcher", EditorStyles.boldLabel); + EditorBuildSettings.sceneListChanged += CollectScenes; + AssetChangeListener.AssetsWereChanged += CollectScenes; - settingsFoldout = EditorGUILayout.Foldout(settingsFoldout, "Settings"); - - if (settingsFoldout) + } + + private void OnDisable() + { + EditorBuildSettings.sceneListChanged -= CollectScenes; + AssetChangeListener.AssetsWereChanged -= CollectScenes; + } + + private void OnGUI() + { + if (EditorApplication.isPlaying) { - EditorGUI.indentLevel++; + if (GUILayout.Button(EXIT_PLAY_MODE, GUILayout.Height(position.height), GUILayout.Width(position.width))) { - showAllScenes = EditorGUILayout.Toggle("Show Absolutely All Scenes", showAllScenes); - autoSaveEnabled = EditorGUILayout.Toggle("Enable Auto Save", autoSaveEnabled); - showDebugLog = EditorGUILayout.Toggle("Show Debug Log", showDebugLog); - compactButtons = EditorGUILayout.Toggle("Compact Buttons", compactButtons); + EditorApplication.ExitPlaymode(); } - EditorGUI.indentLevel--; + return; + } + + if(CurrentSettings.ShowReturnToPreviousButton) + { + DrawReturnToPrevious(); + GUILayout.Space(CurrentSettings.SpaceAfterReturnButton); + } + + DrawSceneButtons(); + GUILayout.Space(CurrentSettings.SpaceAfterSceneButtons); + + if(CurrentSettings.EnableCustomPlayModeStartSceneButton) + { + DrawCustomPlayModeStartSceneButtons(); } - scrollPosition = GUILayout.BeginScrollView(scrollPosition, false, true, GUILayout.Width(350), GUILayout.Height(350)); + DrawSettingsButton(); + } - var scenePaths = showAllScenes - ? GetAllScenePaths() - : GetScenePathsByBuildSettings(); - - var buttonWidth = compactButtons - ? 200 - : 300; + private void DrawReturnToPrevious() + { + if(Previous == "") return; + + GUILayout.Space(10); + + if(GUILayout.Button(RETURN_TO_PREVIOUS_BUTTON, GUILayout.Height(CurrentSettings.ReturnButtonHeight))) + { + SwitchTo(Previous); + } + } - foreach (var scenePath in scenePaths) + private void DrawSceneButtons() + { + if (scenes.Length == 0) + { + EditorGUILayout.HelpBox(" ZERO SCENES FOUND/SELECTED", MessageType.Info); + } + + for (int i = 0; i < scenes.Length; i++) { + string scenePath = scenes[i]; + GUILayout.BeginHorizontal(); GUILayout.FlexibleSpace(); - if (GUILayout.Button(Path.GetFileNameWithoutExtension(scenePath), GUILayout.Width(buttonWidth))) + string buttonText = Path.GetFileNameWithoutExtension(scenePath); + + //add play mode start scene indicator + if (EditorSceneManager.playModeStartScene != null && scenePath == customPlayModeStartScenePath) { - if (autoSaveEnabled && EditorSceneManager.SaveOpenScenes()) - { - if (showDebugLog) - Debug.LogFormat(logFormat, "Scenes saved!"); - } + buttonText = CurrentSettings.CustomStartSceneLabelFormatting.Replace(SCENE_NAME_PLACE, buttonText); + } + //add current scene indicator + if (scenePath == CurrentScene) + { + buttonText = CurrentSettings.CurrentSceneButtonFormatting.Replace(SCENE_NAME_PLACE, buttonText); + } - EditorSceneManager.OpenScene(scenePath); + if (GUILayout.Button(buttonText, GUILayout.Width(position.width), + GUILayout.Height(CurrentSettings.SceneButtonHeight))) + { + SwitchTo(scenePath); } GUILayout.FlexibleSpace(); GUILayout.EndHorizontal(); + + if(i < scenes.Length - 1) + { + GUILayout.Space(CurrentSettings.SpaceBetweenSceneButtons); + } } + } - GUILayout.EndScrollView(); + private void DrawCustomPlayModeStartSceneButtons() + { + if (EditorSceneManager.playModeStartScene == null && GUILayout.Button(ENABLE_CUSTOM_PLAY_MODE_START_SCENE)) + { + EditorSceneManager.playModeStartScene = customPlayModeStartScene; + } + else if (EditorSceneManager.playModeStartScene != null && GUILayout.Button(DISABLE_CUSTOM_PLAY_MODE_START_SCENE)) + { + EditorSceneManager.playModeStartScene = null; + } } - private static string[] GetScenePathsByBuildSettings() + private void DrawSettingsButton() { - var scenes = EditorBuildSettings.scenes; - var paths = new string[scenes.Length]; + if (GUILayout.Button(SETTINGS_BUTTON, GUILayout.Height(CurrentSettings.SettingButtonHeight))) + { + Selection.activeObject = settingsAsset; + } + } + + private void CollectScenes() + { + customPlayModeStartScenePath = EditorBuildSettings.scenes[CurrentSettings.CustomPlayModeStartSceneBuildIndex].path; + customPlayModeStartScene = AssetDatabase.LoadAssetAtPath(customPlayModeStartScenePath); + + switch(CurrentSettings.WhichScenesCollect) + { + case Settings.Collect.OnlyFromBuild: + scenes = new string[EditorBuildSettings.scenes.Length]; + for (int i = 0; i < scenes.Length; i++) + { + scenes[i] = EditorBuildSettings.scenes[i].path; + } + break; + + case Settings.Collect.CustomList: + //clear from nulls + CurrentSettings.CustomSceneList.RemoveAll((asset) => asset == null); + //clear from duplicates + CurrentSettings.CustomSceneList = CurrentSettings.CustomSceneList.Distinct().ToList(); - for (var i = 0; i < scenes.Length; i++) - paths[i] = scenes[i].path; + scenes = new string[CurrentSettings.CustomSceneList.Count]; + for (int i = 0; i < CurrentSettings.CustomSceneList.Count; i++) + { + var sceneAsset = CurrentSettings.CustomSceneList[i]; + if(sceneAsset == null) continue; - return paths; + scenes[i] = AssetDatabase.GetAssetPath(sceneAsset); + } + break; + case Settings.Collect.All: + string[] guids = AssetDatabase.FindAssets("t:Scene"); + scenes = new string[guids.Length]; + for (int i = 0; i < guids.Length; i++) + { + scenes[i] = AssetDatabase.GUIDToAssetPath(guids[i]); + } + break; + default: throw new ArgumentOutOfRangeException(); + } } - private static string[] GetAllScenePaths() + private void SwitchTo(string path) { - var guids = AssetDatabase.FindAssets(FindAssets); - var scenePaths = new string[guids.Length]; + if(path == CurrentScene) return; + + if (CurrentSettings.SaveSceneSwitch) + { + EditorSceneManager.SaveOpenScenes(); + } + + Previous = CurrentScene; + EditorSceneManager.OpenScene(path); + } - for (var i = 0; i < guids.Length; i++) - scenePaths[i] = AssetDatabase.GUIDToAssetPath(guids[i]); + private bool LoadSettings() + { + settingsAsset = AssetDatabase.LoadAssetAtPath(SETTINGS_STORAGE_PATH); + return settingsAsset != null; + } - return scenePaths; + private static void CreateNewSettingsAsset() + { + string[] slicedPath = Path.GetDirectoryName(SETTINGS_STORAGE_PATH)?.Split(Path.DirectorySeparatorChar); + + if(slicedPath != null && slicedPath.Length <= 1) + { + Debug.LogError($"[SCENE SWITCHER] CANNOT CREATE SETTINGS ASSET. INVALID PATH: {SETTINGS_STORAGE_PATH}"); + } + + string currentDirectory = slicedPath[0]; + + for (int i = 1; i < slicedPath.Length; i++) + { + string folder = slicedPath[i]; + string nextDirectory = Path.Join(currentDirectory, folder); + + if (!AssetDatabase.IsValidFolder(nextDirectory)) + { + AssetDatabase.CreateFolder(currentDirectory, folder); + } + + currentDirectory = nextDirectory; + } + + AssetDatabase.Refresh(); + + AssetDatabase.CreateAsset(CreateInstance(),SETTINGS_STORAGE_PATH); + Debug.Log($"[SCENE SWITCHER] CREATED NEW SCENE SWITCHER SETTINGS ASSET AT {Path.GetDirectoryName(SETTINGS_STORAGE_PATH)}"); + } + + [Serializable] + public class Settings + { + public Collect WhichScenesCollect = Collect.OnlyFromBuild; + public bool ShowReturnToPreviousButton = false; + public bool EnableCustomPlayModeStartSceneButton = false; + + public int CustomPlayModeStartSceneBuildIndex = 0; + public bool SaveSceneSwitch = true; + + public List CustomSceneList; + + [Range(15, 50)] public int ReturnButtonHeight = 20; + [Range(15, 50)] public int SceneButtonHeight = 20; + [Range(15, 50)] public int SettingButtonHeight = 15; + + [Range(0, 20)] public int SpaceAfterReturnButton = 10; + [Range(0, 20)] public int SpaceBetweenSceneButtons = 0; + [Range(0, 20)] public int SpaceAfterSceneButtons = 20; + + public string CurrentSceneButtonFormatting = "> SCENE_NAME <"; + public string CustomStartSceneLabelFormatting = "(PM) SCENE_NAME"; + + public enum Collect + { + OnlyFromBuild, + CustomList, + All + } } } -} -#endif \ No newline at end of file +} \ No newline at end of file diff --git a/Editor/SceneSwitcher/SceneSwitcher.cs.meta b/Editor/SceneSwitcher/SceneSwitcher.cs.meta deleted file mode 100644 index 49488ab..0000000 --- a/Editor/SceneSwitcher/SceneSwitcher.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: f64b692beedaa48cfbd9c4060ac0440e -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Editor/SceneSwitcher/SceneSwitcherSettingsInspector.cs b/Editor/SceneSwitcher/SceneSwitcherSettingsInspector.cs new file mode 100644 index 0000000..cc9118e --- /dev/null +++ b/Editor/SceneSwitcher/SceneSwitcherSettingsInspector.cs @@ -0,0 +1,153 @@ +using System.Linq; +using UnityEditor; +using UnityEngine; + +namespace RimuruDevUtils.SceneSwitcher +{ + [CustomEditor(typeof(SceneSwitcherSettingsScriptableObject))] + public class SceneSwitcherSettingsInspector : UnityEditor.Editor + { + private SerializedProperty settingsProp; + + private SerializedProperty whichScenesCollectProp; + private SerializedProperty showReturnButtonProp; + private SerializedProperty enableCustomPlayModeStartSceneButtonProp; + private SerializedProperty customPlayModeStartSceneBuildIndexProp; + private SerializedProperty saveSceneSwitchProp; + private SerializedProperty customSceneListProp; + + private SerializedProperty returnButtonHeightProp; + private SerializedProperty sceneButtonHeightProp; + private SerializedProperty settingButtonHeightProp; + + private SerializedProperty spaceAfterReturnButtonProp; + private SerializedProperty spaceBetweenSceneButtonsProp; + private SerializedProperty spaceAfterSceneButtonsProp; + + private SerializedProperty currentSceneButtonFormattingProp; + private SerializedProperty customPlayModeStartSceneLabelFormattingProp; + + private bool behaviourFoldout = true; + private bool styleFoldout = true; + + private void OnEnable() + { + // Get the Settings property + settingsProp = serializedObject.FindProperty("Settings"); + + // Find all serialized fields inside Settings + whichScenesCollectProp = settingsProp.FindPropertyRelative("WhichScenesCollect"); + showReturnButtonProp = settingsProp.FindPropertyRelative("ShowReturnToPreviousButton"); + enableCustomPlayModeStartSceneButtonProp = settingsProp.FindPropertyRelative("EnableCustomPlayModeStartSceneButton"); + customPlayModeStartSceneBuildIndexProp = settingsProp.FindPropertyRelative("CustomPlayModeStartSceneBuildIndex"); + saveSceneSwitchProp = settingsProp.FindPropertyRelative("SaveSceneSwitch"); + customSceneListProp = settingsProp.FindPropertyRelative("CustomSceneList"); + + returnButtonHeightProp = settingsProp.FindPropertyRelative("ReturnButtonHeight"); + sceneButtonHeightProp = settingsProp.FindPropertyRelative("SceneButtonHeight"); + settingButtonHeightProp = settingsProp.FindPropertyRelative("SettingButtonHeight"); + + spaceAfterReturnButtonProp = settingsProp.FindPropertyRelative("SpaceAfterReturnButton"); + spaceBetweenSceneButtonsProp = settingsProp.FindPropertyRelative("SpaceBetweenSceneButtons"); + spaceAfterSceneButtonsProp = settingsProp.FindPropertyRelative("SpaceAfterSceneButtons"); + + currentSceneButtonFormattingProp = settingsProp.FindPropertyRelative("CurrentSceneButtonFormatting"); + customPlayModeStartSceneLabelFormattingProp = settingsProp.FindPropertyRelative("CustomStartSceneLabelFormatting"); + } + + public override void OnInspectorGUI() + { + serializedObject.Update(); + + SceneSwitcherSettingsScriptableObject settingsObject = target as SceneSwitcherSettingsScriptableObject; + + EditorGUILayout.LabelField("Scene Switcher Settings", EditorStyles.boldLabel); + + behaviourFoldout = EditorGUILayout.Foldout(behaviourFoldout, "Behaviour", EditorStyles.foldout); + if(behaviourFoldout) + { + EditorGUILayout.PropertyField(whichScenesCollectProp); + + if (settingsObject.Settings.WhichScenesCollect == SceneSwitcher.Settings.Collect.CustomList) + { + //draw list + EditorGUILayout.PropertyField(customSceneListProp, true); + + //draw some handy buttons + if (GUILayout.Button("Add All Scenes From Project")) + { + string[] guids = AssetDatabase.FindAssets("t:Scene"); + foreach (string guid in guids) + { + settingsObject.Settings.CustomSceneList.Add(AssetDatabase.LoadAssetAtPath(AssetDatabase.GUIDToAssetPath(guid))); + } + EditorUtility.SetDirty(settingsObject); + } + if (GUILayout.Button("Add Scenes From Build")) + { + foreach (EditorBuildSettingsScene scene in EditorBuildSettings.scenes) + { + settingsObject.Settings.CustomSceneList.Add(AssetDatabase.LoadAssetAtPath(scene.path)); + } + EditorUtility.SetDirty(settingsObject); + } + if (GUILayout.Button("Clear List")) + { + settingsObject.Settings.CustomSceneList.Clear(); + EditorUtility.SetDirty(settingsObject); + } + + //check if contains nulls + if (settingsObject.Settings.CustomSceneList.Any((asset) => asset == null)) + { + EditorGUILayout.HelpBox("LIST CONTAINS NULL ELEMENTS. THEY WILL BE REMOVED", MessageType.Warning); + EditorGUILayout.Separator(); + } + //check if contains duplicates + bool hasDuplicates = settingsObject.Settings.CustomSceneList.GroupBy(x => x) + .Any(g => g.Count() > 1); + + if (hasDuplicates) + { + EditorGUILayout.HelpBox("LIST CONTAINS DUPLICATES. THEY WILL BE REMOVED", MessageType.Warning); + EditorGUILayout.Separator(); + } + } + EditorGUILayout.PropertyField(showReturnButtonProp); + EditorGUILayout.PropertyField(enableCustomPlayModeStartSceneButtonProp); + + if(settingsObject.Settings.EnableCustomPlayModeStartSceneButton) + { + EditorGUILayout.PropertyField(customPlayModeStartSceneBuildIndexProp); + } + + EditorGUILayout.PropertyField(saveSceneSwitchProp); + + } + + styleFoldout = EditorGUILayout.Foldout(styleFoldout, "Button Style"); + if(styleFoldout) + { + EditorGUILayout.IntSlider(returnButtonHeightProp, 15, 50, new GUIContent("Return Button Height")); + EditorGUILayout.IntSlider(spaceAfterReturnButtonProp, 0, 20, new GUIContent("Space After Return To Previous Button")); + + EditorGUILayout.Separator(); + + EditorGUILayout.IntSlider(sceneButtonHeightProp, 15, 50, new GUIContent("Scene Button Height")); + EditorGUILayout.IntSlider(spaceBetweenSceneButtonsProp, 0, 20, new GUIContent("Space Between Scene Buttons")); + EditorGUILayout.IntSlider(spaceAfterSceneButtonsProp, 0, 20, new GUIContent("Space After Scene Buttons")); + + EditorGUILayout.Separator(); + + EditorGUILayout.IntSlider(settingButtonHeightProp, 15, 50, new GUIContent("Setting Button Height")); + + EditorGUILayout.Separator(); + + EditorGUILayout.PropertyField(currentSceneButtonFormattingProp); + EditorGUILayout.PropertyField(customPlayModeStartSceneLabelFormattingProp); + } + + serializedObject.ApplyModifiedProperties(); + } + } +} \ No newline at end of file diff --git a/Editor/SceneSwitcher/SceneSwitcherSettingsScriptableObject.cs b/Editor/SceneSwitcher/SceneSwitcherSettingsScriptableObject.cs new file mode 100644 index 0000000..cc82092 --- /dev/null +++ b/Editor/SceneSwitcher/SceneSwitcherSettingsScriptableObject.cs @@ -0,0 +1,9 @@ +using UnityEngine; + +namespace RimuruDevUtils.SceneSwitcher +{ + public sealed class SceneSwitcherSettingsScriptableObject : ScriptableObject + { + public SceneSwitcher.Settings Settings; + } +} \ No newline at end of file diff --git a/LICENSE.meta b/LICENSE.meta deleted file mode 100644 index e808ed5..0000000 --- a/LICENSE.meta +++ /dev/null @@ -1,7 +0,0 @@ -fileFormatVersion: 2 -guid: 643d74a2a962c4815a7fe31328ceaba2 -DefaultImporter: - externalObjects: {} - userData: - assetBundleName: - assetBundleVariant: diff --git a/README.md b/README.md index 4e8f8e6..9bf16e0 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -

⭐SceneSwitcher⭐

+

SceneSwitcher

Made With Unity @@ -29,50 +29,62 @@

-## Описание +## Description -**SceneSwitcher** – это удобный инструмент для Unity Editor, который позволяет быстро и легко переключаться между -сценами в проекте. Это решение особенно полезно в крупных проектах Unity, где управление множеством сцен может быть -затруднено. +**SceneSwitcher** – is a handy Unity editor tool that helps you move between scenes. -## Основные функции +![alt text](https://github.com/destructive-crab/SceneSwitcher/blob/main/Screenshots/Custom.png) -- **Быстрый переход между сценами**: Переключайтесь между сценами одним кликом в окне инструмента. -- **Автосохранение**: Опционально сохраняйте текущую сцену перед переключением (включается/выключается). -- **Отображение сцен**: Выбирайте, показывать ли **все** сцены в проекте или только те, что указаны в настройках - сборки (Build Settings). -- **Режим Compact Buttons**: Включайте или отключайте компактный режим, чтобы управлять шириной кнопок и их - расположением (узкие кнопки по центру или более широкие). -- **Отладочный лог**: По необходимости выводите сообщения в `Console` при сохранении или переключении сцен. +## Features -## Установка +- **Fast switching between scenes**: You can switch to any scene just from tool's window. +- **Custom Play Mode Start Scene**: you can change from which scene you want to enter into Play Mode. Or disable this feature. +- **Return Button**: Scene Switcher remembers the previous scene and can return to it. Or you can disable this feature. +- **Different scene pools**: Scene Switcher provides three types of scene pools: from **build settings**, **all** from project or **custom list**. +- **Highly customizable**: every part of scene switcher window can be customized. +- **Safe**: scenes are saved on switching, scene switcher stuff is disabled on Play Mode. -1. Откройте Unity и перейдите в ваш проект. -2. Откройте **Window** → **Package Manager**. -3. В **Package Manager** нажмите на кнопку `+`, затем выберите **Add package from git URL...**. -4. Вставьте следующий URL:`https://github.com/RimuruDev/SceneSwitcher.git` -5. Нажмите **Enter** и дождитесь завершения установки. +## Installation +### With Unity Package +1. Download latest release from github page. +2. Drag and drop unitypackage file in your project. +3. Check if SceneSwitcher source was imported correctly: in Editor folder. +### With Package Manager +1. Open your Unity project. +2. Open **Window** → **Package Manager**. +3. In **Package Manager** press `+` button, then choose **Add package from git URL...**. +4. Paste this URL:`https://github.com/RimuruDev/SceneSwitcher.git` +5. Press **Enter** and wait for the installation to complete. -## Использование +## Usage -После установки **SceneSwitcher** инструмент появляется в меню Unity: -**RimuruDev Tools** → **Scene Switcher**. +After **SceneSwitcher** installation tool appears in Unity menu: +**Tools** → **Scene Switcher**. -1. Откройте окно **Scene Switcher**. -2. Отметьте галочкой, хотите ли вы показывать **все сцены** или только **Build Settings**. -3. Настройте **Автосохранение** (Auto Save) и **Debug Log** (отладочные сообщения) по желанию. -4. При необходимости включите **Compact Buttons** – кнопки станут короче и будут выровнены по центру. -5. Нажмите на любую сцену для мгновенного переключения. +Open **Scene Switcher** window. In Assets/Editor/SceneSwitcher settings asset will be created. +Then you can configure Scene Switcher as you like. Just open settings by pressing Open Settings button in Scene Switcher. -![image](https://github.com/RimuruDev/SceneSwitcher/assets/85500556/0d0f8801-6ed1-44c2-8c44-5908af19cda1) +In Behaviour menu you can edit: +1. Which Scenes Collect - there are three options + 1. Only From Build - it means that SceneSwitcher will show you only that scenes that you have in Build Settings. + 2. Custom List - with this option you can configure your scenes list as you wish. Just add your Scene asset in list. + 3. All - Scene Switcher will show you all scenes that you have in your project. +2. Show Return To Previous Button - you can enable and disable Return button in Scene Switcher. By pressing it Scene Switcher will switch you to previously opened scene. +3. Enable Custom Play Mode Start Scene - when enabled, allows you to change scene from which Play Mode starts. Then you can enable and disable it from Scene Switcher. +4. Custom Play Mode Start Scene Build Index - type here index of Play Mode Start Scene. +5. Save Scene On Switch - not recommended to disable. If enabled, scene will be automaticly saved when switch. -## Контакты +In Button Style menu you can edit: +1. Heights and button spacings +2. Formatting of current scene butoon - type there what you want to see on current scene button: content of this field will be displayed on button, SCENE_NAME will be replaced with name of scene. +3. Formatting of Play Mode Start Scene - type there what you want to see on start scene button: content of this field will be displayed on button, SCENE_NAME will be replaced with name of scene. -Если у вас есть вопросы или предложения, вы можете связаться со мной: +## Examples -- **Email**: [rimuru.dev@gmail.com](mailto:rimuru.dev@gmail.com) -- **GitHub**: [RimuruDev](https://github.com/RimuruDev) +### With Custom Scene List: +![alt text](https://github.com/destructive-crab/SceneSwitcher/blob/main/Screenshots/CustomSceneList.png) ![alt text](https://github.com/destructive-crab/SceneSwitcher/blob/main/Screenshots/CustomSceneListSettings.png) + +### Minimal +![alt text](https://github.com/destructive-crab/SceneSwitcher/blob/main/Screenshots/Minimal.png) ![alt text](https://github.com/destructive-crab/SceneSwitcher/blob/main/Screenshots/SettingsMinimal.png) -## Лицензия -Проект распространяется под лицензией **MIT**. Подробности см. в файле [`LICENSE`](LICENSE). \ No newline at end of file diff --git a/README.md.meta b/README.md.meta deleted file mode 100644 index b381349..0000000 --- a/README.md.meta +++ /dev/null @@ -1,7 +0,0 @@ -fileFormatVersion: 2 -guid: ba091e056d74846c4a5285f20c93d236 -TextScriptImporter: - externalObjects: {} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Screenshots/Custom.png b/Screenshots/Custom.png new file mode 100644 index 0000000..521aca8 Binary files /dev/null and b/Screenshots/Custom.png differ diff --git a/Screenshots/CustomSceneList.png b/Screenshots/CustomSceneList.png new file mode 100644 index 0000000..289c1a2 Binary files /dev/null and b/Screenshots/CustomSceneList.png differ diff --git a/Screenshots/CustomSceneListSettings.png b/Screenshots/CustomSceneListSettings.png new file mode 100644 index 0000000..014cb36 Binary files /dev/null and b/Screenshots/CustomSceneListSettings.png differ diff --git a/Screenshots/Minimal.png b/Screenshots/Minimal.png new file mode 100644 index 0000000..a74693e Binary files /dev/null and b/Screenshots/Minimal.png differ diff --git a/Screenshots/SettingsMinimal.png b/Screenshots/SettingsMinimal.png new file mode 100644 index 0000000..a7e023b Binary files /dev/null and b/Screenshots/SettingsMinimal.png differ diff --git a/package.json b/package.json index 50cfb69..2502863 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "com.rimurudev.sceneswitcher", - "version": "1.6.4", + "version": "2.0", "displayName": "RimuruDev", "description": "Easily and conveniently navigate scenes in Unity without having to manually search for the scene you need.", "unity": "2019.1", @@ -22,4 +22,4 @@ "email": "rimuru.dev@gmail.com", "url": "https://github.com/RimuruDev" } -} \ No newline at end of file +} diff --git a/package.json.meta b/package.json.meta deleted file mode 100644 index 64220c1..0000000 --- a/package.json.meta +++ /dev/null @@ -1,7 +0,0 @@ -fileFormatVersion: 2 -guid: f777aa810132348779101ce7937c0474 -TextScriptImporter: - externalObjects: {} - userData: - assetBundleName: - assetBundleVariant: