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..d38cb88 100644 --- a/Editor/SceneSwitcher/SceneSwitcher.cs +++ b/Editor/SceneSwitcher/SceneSwitcher.cs @@ -1,113 +1,342 @@ // **************************************************************** // // // 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; +using UnityEngine.Serialization; -namespace AbyssMoth.External.RimuruDevUtils.Editor.SceneSwitcher +namespace RimuruDevUtils.SceneSwitcher { - public sealed class SceneSwitcher : EditorWindow + public sealed class SceneSwitcher : EditorWindow, IHasCustomMenu { - 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_START_SCENE = "Enable Custom 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; + + private static bool CustomStartSceneEnabledInProject => EditorSceneManager.playModeStartScene != null; + + [MenuItem("Tools/Scene Switcher")] private static void ShowWindow() { - GetWindow(); + GetWindow(typeof(SceneSwitcher)); } - private void OnGUI() + private void Awake() + { + if (!LoadSettings()) + { + CreateNewSettingsAsset(); + LoadSettings(); + } + + CollectScenes(); + + if (CurrentSettings.AutoEnableCustomPlayModeStartScene && !CustomStartSceneEnabledInProject) + { + SwitchCustomStartSceneEnabled(); + } + } + + private void OnEnable() { - GUILayout.Label("Scene Switcher", EditorStyles.boldLabel); + EditorBuildSettings.sceneListChanged += CollectScenes; + AssetChangeListener.AssetsWereChanged += CollectScenes; + + } + + private void OnDisable() + { + EditorBuildSettings.sceneListChanged -= CollectScenes; + AssetChangeListener.AssetsWereChanged -= CollectScenes; + } - settingsFoldout = EditorGUILayout.Foldout(settingsFoldout, "Settings"); - - if (settingsFoldout) + 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; } - scrollPosition = GUILayout.BeginScrollView(scrollPosition, false, true, GUILayout.Width(350), GUILayout.Height(350)); + if(CurrentSettings.ShowReturnToPreviousButton) + { + DrawReturnToPrevious(); + GUILayout.Space(CurrentSettings.SpaceAfterReturnButton); + } + + DrawSceneButtons(); + } - 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 SwitchCustomStartSceneEnabled() + { + if (!CustomStartSceneEnabledInProject) + { + EditorSceneManager.playModeStartScene = customPlayModeStartScene; + } + else + { + EditorSceneManager.playModeStartScene = null; + } } - private static string[] GetScenePathsByBuildSettings() + private void OpenSettings() { - var scenes = EditorBuildSettings.scenes; - var paths = new string[scenes.Length]; + Selection.activeObject = settingsAsset; + } - for (var i = 0; i < scenes.Length; i++) - paths[i] = scenes[i].path; + 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; - return paths; + case Settings.Collect.CustomList: + //clear from nulls + CurrentSettings.CustomSceneList.RemoveAll((asset) => asset == null); + //clear from duplicates + CurrentSettings.CustomSceneList = CurrentSettings.CustomSceneList.Distinct().ToList(); + + scenes = new string[CurrentSettings.CustomSceneList.Count]; + for (int i = 0; i < CurrentSettings.CustomSceneList.Count; i++) + { + var sceneAsset = CurrentSettings.CustomSceneList[i]; + if(sceneAsset == null) continue; + + 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 void SwitchTo(string path) + { + if(path == CurrentScene) return; + + if (CurrentSettings.SaveSceneSwitch) + { + EditorSceneManager.SaveOpenScenes(); + } + + Previous = CurrentScene; + EditorSceneManager.OpenScene(path); } - private static string[] GetAllScenePaths() + private bool LoadSettings() { - var guids = AssetDatabase.FindAssets(FindAssets); - var scenePaths = new string[guids.Length]; + settingsAsset = AssetDatabase.LoadAssetAtPath(SETTINGS_STORAGE_PATH); + return settingsAsset != null; + } + + private bool SaveSettingsAsset() + { + if (settingsAsset == null) return false; + + EditorUtility.SetDirty(settingsAsset); + AssetDatabase.SaveAssetIfDirty(settingsAsset); + return true; + } - for (var i = 0; i < guids.Length; i++) - scenePaths[i] = AssetDatabase.GUIDToAssetPath(guids[i]); + 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); + } - return scenePaths; + 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)}"); + } + + public void AddItemsToMenu(GenericMenu menu) + { + GUIContent openSettings = new GUIContent(SETTINGS_BUTTON); + menu.AddItem(openSettings, false, OpenSettings); + + menu.AddSeparator(""); + + GUIContent switchStartSceneEnabled = new GUIContent(ENABLE_CUSTOM_START_SCENE); + menu.AddItem(switchStartSceneEnabled, CustomStartSceneEnabledInProject, SwitchCustomStartSceneEnabled); + + menu.AddSeparator(""); + + //fast collect method switching + GUIContent onlyFromBuild = new GUIContent("Only From Build"); + GUIContent customList = new GUIContent("Custom List"); + GUIContent all = new GUIContent("All"); + + menu.AddItem(onlyFromBuild, CurrentSettings.WhichScenesCollect == Settings.Collect.OnlyFromBuild, SetCollectToOnlyFromBuild); + menu.AddItem(customList, CurrentSettings.WhichScenesCollect == Settings.Collect.CustomList, SetCollectToCustomList); + menu.AddItem(all, CurrentSettings.WhichScenesCollect == Settings.Collect.All, SetCollectToAll); + } + + private void SetCollectToOnlyFromBuild() + { + CurrentSettings.WhichScenesCollect = Settings.Collect.OnlyFromBuild; + SaveSettingsAsset(); + } + + private void SetCollectToCustomList() + { + CurrentSettings.WhichScenesCollect = Settings.Collect.CustomList; + SaveSettingsAsset(); + } + + private void SetCollectToAll() + { + CurrentSettings.WhichScenesCollect = Settings.Collect.All; + SaveSettingsAsset(); + } + + [Serializable] + public class Settings + { + public Collect WhichScenesCollect = Collect.OnlyFromBuild; + public bool ShowReturnToPreviousButton = false; + + public bool AutoEnableCustomPlayModeStartScene = 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(0, 20)] public int SpaceAfterReturnButton = 10; + [Range(0, 20)] public int SpaceBetweenSceneButtons = 0; + + 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..0e28727 --- /dev/null +++ b/Editor/SceneSwitcher/SceneSwitcherSettingsInspector.cs @@ -0,0 +1,141 @@ +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 customPlayModeStartSceneBuildIndexAutoEnableProp; + private SerializedProperty customPlayModeStartSceneBuildIndexProp; + private SerializedProperty saveSceneSwitchProp; + private SerializedProperty customSceneListProp; + + private SerializedProperty returnButtonHeightProp; + private SerializedProperty sceneButtonHeightProp; + + private SerializedProperty spaceAfterReturnButtonProp; + private SerializedProperty spaceBetweenSceneButtonsProp; + + 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"); + customPlayModeStartSceneBuildIndexAutoEnableProp = settingsProp.FindPropertyRelative("AutoEnableCustomPlayModeStartScene"); + customPlayModeStartSceneBuildIndexProp = settingsProp.FindPropertyRelative("CustomPlayModeStartSceneBuildIndex"); + saveSceneSwitchProp = settingsProp.FindPropertyRelative("SaveSceneSwitch"); + customSceneListProp = settingsProp.FindPropertyRelative("CustomSceneList"); + + returnButtonHeightProp = settingsProp.FindPropertyRelative("ReturnButtonHeight"); + sceneButtonHeightProp = settingsProp.FindPropertyRelative("SceneButtonHeight"); + + spaceAfterReturnButtonProp = settingsProp.FindPropertyRelative("SpaceAfterReturnButton"); + spaceBetweenSceneButtonsProp = settingsProp.FindPropertyRelative("SpaceBetweenSceneButtons"); + + 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(customPlayModeStartSceneBuildIndexProp); + EditorGUILayout.PropertyField(customPlayModeStartSceneBuildIndexAutoEnableProp); + + 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.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..508917d 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -

⭐SceneSwitcher⭐

+

SceneSwitcher

Made With Unity @@ -7,72 +7,60 @@ License - Last Commit + Last Commit - Repo Size + Last Release - - Downloads - - - Last Release - - - GitHub stars - - - GitHub user stars - - - - -

-## Описание +## Description + +**SceneSwitcher** – is a handy Unity editor tool that helps you move between scenes. -**SceneSwitcher** – это удобный инструмент для Unity Editor, который позволяет быстро и легко переключаться между -сценами в проекте. Это решение особенно полезно в крупных проектах Unity, где управление множеством сцен может быть -затруднено. +![alt text](https://github.com/destructive-crab/SceneSwitcher/blob/main/Screenshots/SwitcherShowcase.png) -## Основные функции +## Features -- **Быстрый переход между сценами**: Переключайтесь между сценами одним кликом в окне инструмента. -- **Автосохранение**: Опционально сохраняйте текущую сцену перед переключением (включается/выключается). -- **Отображение сцен**: Выбирайте, показывать ли **все** сцены в проекте или только те, что указаны в настройках - сборки (Build Settings). -- **Режим Compact Buttons**: Включайте или отключайте компактный режим, чтобы управлять шириной кнопок и их - расположением (узкие кнопки по центру или более широкие). -- **Отладочный лог**: По необходимости выводите сообщения в `Console` при сохранении или переключении сцен. +- **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. -## Установка +## 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. -1. Откройте Unity и перейдите в ваш проект. -2. Откройте **Window** → **Package Manager**. -3. В **Package Manager** нажмите на кнопку `+`, затем выберите **Add package from git URL...**. -4. Вставьте следующий URL:`https://github.com/RimuruDev/SceneSwitcher.git` -5. Нажмите **Enter** и дождитесь завершения установки. +## Usage -## Использование +After **SceneSwitcher** installation tool appears in Unity menu: +**Tools** → **Scene Switcher**. -После установки **SceneSwitcher** инструмент появляется в меню Unity: -**RimuruDev Tools** → **Scene Switcher**. +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 menu. -1. Откройте окно **Scene Switcher**. -2. Отметьте галочкой, хотите ли вы показывать **все сцены** или только **Build Settings**. -3. Настройте **Автосохранение** (Auto Save) и **Debug Log** (отладочные сообщения) по желанию. -4. При необходимости включите **Compact Buttons** – кнопки станут короче и будут выровнены по центру. -5. Нажмите на любую сцену для мгновенного переключения. +![alt text](https://github.com/destructive-crab/SceneSwitcher/blob/main/Screenshots/HowToOpenSettings.png) -![image](https://github.com/RimuruDev/SceneSwitcher/assets/85500556/0d0f8801-6ed1-44c2-8c44-5908af19cda1) +In Behaviour menu you can edit: -## Контакты +![alt text](https://github.com/destructive-crab/SceneSwitcher/blob/main/Screenshots/BehaviourSettingsShowcase.png) -Если у вас есть вопросы или предложения, вы можете связаться со мной: +1. Which Scenes Collect - there are three options + - Only From Build - it means that SceneSwitcher will show you only that scenes that you have in Build Settings. + - Custom List - with this option you can configure your scenes list as you wish. Just add your Scene asset in list. + - 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. Custom Play Mode Start Scene Build Index - type here index of Play Mode Start Scene. +4. Auto Enable Custom Play Mode Start Scene - when enabled, it will automatically change play mode start scene when you open project. If not, you will need to switch it on manually. +5. Save Scene On Switch - not recommended to disable. If enabled, scene will be automaticly saved when switch. -- **Email**: [rimuru.dev@gmail.com](mailto:rimuru.dev@gmail.com) -- **GitHub**: [RimuruDev](https://github.com/RimuruDev) +In Button Style menu you can edit: -## Лицензия +![alt text](https://github.com/destructive-crab/SceneSwitcher/blob/main/Screenshots/StyleSettingsShowcase.png) -Проект распространяется под лицензией **MIT**. Подробности см. в файле [`LICENSE`](LICENSE). \ No newline at end of file +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. 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/BehaviourSettingsShowcase.png b/Screenshots/BehaviourSettingsShowcase.png new file mode 100644 index 0000000..db1f5aa Binary files /dev/null and b/Screenshots/BehaviourSettingsShowcase.png differ diff --git a/Screenshots/HowToOpenSettings.png b/Screenshots/HowToOpenSettings.png new file mode 100644 index 0000000..cb1b497 Binary files /dev/null and b/Screenshots/HowToOpenSettings.png differ diff --git a/Screenshots/StyleSettingsShowcase.png b/Screenshots/StyleSettingsShowcase.png new file mode 100644 index 0000000..c065dd0 Binary files /dev/null and b/Screenshots/StyleSettingsShowcase.png differ diff --git a/Screenshots/SwitcherShowcase.png b/Screenshots/SwitcherShowcase.png new file mode 100644 index 0000000..b264958 Binary files /dev/null and b/Screenshots/SwitcherShowcase.png differ diff --git a/package.json b/package.json index 50cfb69..6f2882d 100644 --- a/package.json +++ b/package.json @@ -1,15 +1,11 @@ { - "name": "com.rimurudev.sceneswitcher", - "version": "1.6.4", - "displayName": "RimuruDev", + "name": "com.destructive_crab.sceneswitcher", + "version": "2.2", + "displayName": "destructive_crab", "description": "Easily and conveniently navigate scenes in Unity without having to manually search for the scene you need.", "unity": "2019.1", "dependencies": {}, "keywords": [ - "rimurudev", - "rimuru-dev", - "abyssmoth", - "abyss-moth", "unity", "unity2d", "unity-editor", @@ -18,8 +14,7 @@ "unity-tools" ], "author": { - "name": "RimuruDev", - "email": "rimuru.dev@gmail.com", - "url": "https://github.com/RimuruDev" + "name": "destructive_crab", + "url": "https://github.com/destructive-crab" } -} \ 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: