diff --git a/Assets/Scene Handler Editor/Editor/ScenesWindow.cs b/Assets/Scene Handler Editor/Editor/ScenesWindow.cs index d255c7b..c511136 100644 --- a/Assets/Scene Handler Editor/Editor/ScenesWindow.cs +++ b/Assets/Scene Handler Editor/Editor/ScenesWindow.cs @@ -1,27 +1,48 @@ -/// This script is created By Salman Hayat, is free to use and is available on Github -/// for any queries , contact at salmanhayat16@gmail.com -/// Github link: https://github.com/salmanhayat1998/Scenes-Navigator -/// Social link: https://www.linkedin.com/in/salmanhayat/ - -using System.Collections.Generic; +using System.Collections.Generic; using UnityEngine; using UnityEditor; using UnityEditor.SceneManagement; using UnityEngine.SceneManagement; using System.IO; -public class ScenesWindow : EditorWindow +public class TestWindow : EditorWindow { public List scenes = new List(); private EditorBuildSettingsScene[] EditroScenes; Vector2 scrollPos = Vector2.zero; static int assetno = 0; + float _w; + float _h; + float windowWidth + { + get + { + if (_w==0) + { + _w = GetWindow(false, "Project Scenes", true).position.width; + } + return _w; + } + } + float windowHeight + { + get + { + if (_h==0) + { + _h = GetWindow(false, "Project Scenes", true).position.height; + } + return _h; + } + } [MenuItem("Window/Scenes Holder")] public static void Open() { - GetWindow(false, "Project Scenes", true); + TestWindow testWindow = GetWindow(false, "Project Scenes", true); + testWindow.Show(); + //width = testWindow.position.width; + //height = testWindow.position.height; } - void OnGUI() { GUILayout.Label("Scenes Menu", EditorStyles.boldLabel); @@ -55,11 +76,12 @@ void OnGUI() if (scenes.Count > 0) { - scrollPos = EditorGUILayout.BeginScrollView(scrollPos, false, false, GUILayout.Width(EditorWindow.GetWindow(typeof(ScenesWindow)).position.width), GUILayout.Height(EditorWindow.GetWindow(typeof(ScenesWindow)).position.height - 120)); + scrollPos = EditorGUILayout.BeginScrollView(scrollPos, false, false, GUILayout.Width(windowWidth), GUILayout.Height(windowHeight - 120)); for (int i = 0; i < scenes.Count; i++) { EditorGUILayout.BeginHorizontal(); scenes[i] = EditorGUILayout.ObjectField(scenes[i], typeof(SceneAsset), true); + GUI.backgroundColor = Color.green; if (GUILayout.Button("Open")) { @@ -72,6 +94,16 @@ void OnGUI() EditorSceneManager.SaveCurrentModifiedScenesIfUserWantsTo(); EditorSceneManager.OpenScene(AssetDatabase.GetAssetPath(scenes[i]), OpenSceneMode.Additive); } + //if (EditorSceneManager.loadedSceneCount>1 ) + //{ + // // Debug.Log(EditorSceneManager.GetSceneManagerSetup().Length); + // GUI.backgroundColor = Color.yellow; + // if (GUILayout.Button("Unload")) + // { + // //EditorSceneManager.UnloadScene(AssetDatabase.GetAssetPath(scenes[i])); + // } + + //} GUI.backgroundColor = Color.red; Texture icon = Resources.Load("delicon") as Texture; if (GUILayout.Button(icon)) diff --git a/README.md b/README.md index 16d18ff..677e41c 100644 --- a/README.md +++ b/README.md @@ -4,12 +4,20 @@ A tool to place all your scenes and easily navigate between with a single click. ## How to Use: -Go to Windows>Scenes Holder -press Get All build scenes button or Add scenes manually from your project. +1-Go to Windows>Scenes Holder. +2-press Get All build scenes button or Add scenes manually from your project. +3-Place the window anywhere in your project layout. +### Tutorial: -![2](https://user-images.githubusercontent.com/36339248/192696117-fcba9796-394e-42a6-aba8-5eb748171d77.png) +https://youtu.be/xNuk0OEL09c -Boom! you are ready to go. +#### Get Scenes from build Settings: +![Get Build Scene](https://user-images.githubusercontent.com/36339248/199532169-e2916258-a1d5-45b6-a9d6-bc9f95bf5b52.png) -![Untitled](https://user-images.githubusercontent.com/36339248/192695551-6609aec9-be44-4823-90eb-0c0c8c17ff25.png) +#### Open Scenes Additively: + +![Open Scene Additively](https://user-images.githubusercontent.com/36339248/199532410-32f8e931-28a1-4cec-84aa-5180b1f54755.png) + +#### Ask before switching: +![Add a heading](https://user-images.githubusercontent.com/36339248/199532442-16516e16-dfb6-4d83-aa15-1067b4b1958a.png)