Skip to content

Commit

Permalink
Revert "Merge branch 'main' of https://github.com/salmanhayat1998/Sce…
Browse files Browse the repository at this point in the history
…nes-Navigator"

This reverts commit d100c72, reversing
changes made to dcfc7af.
  • Loading branch information
salmanhayat1998 committed Nov 2, 2022
1 parent d100c72 commit bfc8a0b
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 55 deletions.
52 changes: 10 additions & 42 deletions Assets/Scene Handler Editor/Editor/ScenesWindow.cs
Original file line number Diff line number Diff line change
@@ -1,48 +1,27 @@
using System.Collections.Generic;
/// 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 UnityEngine;
using UnityEditor;
using UnityEditor.SceneManagement;
using UnityEngine.SceneManagement;
using System.IO;

public class TestWindow : EditorWindow
public class ScenesWindow : EditorWindow
{
public List<Object> scenes = new List<Object>();
private EditorBuildSettingsScene[] EditroScenes;
Vector2 scrollPos = Vector2.zero;
static int assetno = 0;
float _w;
float _h;
float windowWidth
{
get
{
if (_w==0)
{
_w = GetWindow<TestWindow>(false, "Project Scenes", true).position.width;
}
return _w;
}
}
float windowHeight
{
get
{
if (_h==0)
{
_h = GetWindow<TestWindow>(false, "Project Scenes", true).position.height;
}
return _h;
}
}
[MenuItem("Window/Scenes Holder")]
public static void Open()
{
TestWindow testWindow = GetWindow<TestWindow>(false, "Project Scenes", true);
testWindow.Show();
//width = testWindow.position.width;
//height = testWindow.position.height;
GetWindow<ScenesWindow>(false, "Project Scenes", true);
}

void OnGUI()
{
GUILayout.Label("Scenes Menu", EditorStyles.boldLabel);
Expand Down Expand Up @@ -76,12 +55,11 @@ void OnGUI()

if (scenes.Count > 0)
{
scrollPos = EditorGUILayout.BeginScrollView(scrollPos, false, false, GUILayout.Width(windowWidth), GUILayout.Height(windowHeight - 120));
scrollPos = EditorGUILayout.BeginScrollView(scrollPos, false, false, GUILayout.Width(EditorWindow.GetWindow(typeof(ScenesWindow)).position.width), GUILayout.Height(EditorWindow.GetWindow(typeof(ScenesWindow)).position.height - 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"))
{
Expand All @@ -94,16 +72,6 @@ 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))
Expand Down
18 changes: 5 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,20 +4,12 @@ A tool to place all your scenes and easily navigate between with a single click.

## How to Use:

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.
Go to Windows>Scenes Holder
press Get All build scenes button or Add scenes manually from your project.

### Tutorial:

https://youtu.be/xNuk0OEL09c
![2](https://user-images.githubusercontent.com/36339248/192696117-fcba9796-394e-42a6-aba8-5eb748171d77.png)

#### Get Scenes from build Settings:
![Get Build Scene](https://user-images.githubusercontent.com/36339248/199532169-e2916258-a1d5-45b6-a9d6-bc9f95bf5b52.png)
Boom! you are ready to go.

#### 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)
![Untitled](https://user-images.githubusercontent.com/36339248/192695551-6609aec9-be44-4823-90eb-0c0c8c17ff25.png)

0 comments on commit bfc8a0b

Please sign in to comment.