Skip to content

Commit e22b765

Browse files
authored
Merge pull request #5 from coryleach/dev
Merge 1.0.2
2 parents e449ce6 + cdbe8b4 commit e22b765

File tree

5 files changed

+46
-32
lines changed

5 files changed

+46
-32
lines changed

Editor/SceneSwitcherWindow.cs

+12-12
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ private static void OpenWindow()
1919
private Vector2 _scrollPosition;
2020

2121
[System.Serializable]
22-
public class SceneSwitcherData
22+
private class SceneSwitcherData
2323
{
2424
public List<string> sceneGuids = new List<string>();
2525
public bool sortRecentToTop = true;
@@ -49,7 +49,7 @@ private void OnDisable()
4949
PlayerPrefs.SetString(PrefsKey, JsonUtility.ToJson(_sceneSwitcherData));
5050
}
5151

52-
private bool _editing = false;
52+
private bool _editing;
5353

5454
private void OnGUI()
5555
{
@@ -76,6 +76,9 @@ private void OnGUI()
7676
return;
7777
case EventType.DragExited:
7878
break;
79+
default:
80+
//Other events ignored
81+
break;
7982
}
8083

8184
if (_sceneSwitcherData.sceneGuids.Count > 0)
@@ -160,9 +163,10 @@ private void SceneListGui()
160163

161164
GUILayout.EndVertical();
162165

163-
int lineHeight = 18;
166+
const int lineHeight = 18;
164167
if (_editing)
165168
{
169+
//Draw Toggle Buttons
166170
GUILayout.BeginHorizontal();
167171
_sceneSwitcherData.sortRecentToTop = GUILayout.Toggle(_sceneSwitcherData.sortRecentToTop,
168172
new GUIContent("Auto Sort", "Will sort most recently used scenes to the top"),
@@ -173,19 +177,16 @@ private void SceneListGui()
173177
new GUIContent("Close", "Will close/unload other scenes when additive loading is active"),
174178
GUILayout.Height(lineHeight));
175179
GUILayout.EndHorizontal();
176-
}
177-
178-
if (_editing)
179-
{
180+
181+
//Draw Done Button
180182
GUILayout.BeginHorizontal();
181183

182184
GUILayout.FlexibleSpace();
183-
GUI.backgroundColor = _editing ? Color.green : Color.red;
184-
if (GUILayout.Button(_editing ? "Done" : "Edit", GUILayout.MaxWidth(60)))
185+
GUI.backgroundColor = Color.green;
186+
if (GUILayout.Button("Done", GUILayout.MaxWidth(60)))
185187
{
186188
_editing = !_editing;
187189
}
188-
189190
GUI.backgroundColor = Color.white;
190191

191192
GUILayout.EndHorizontal();
@@ -235,10 +236,9 @@ private void SwitchToScene(string path)
235236
}
236237

237238
//Close other scenes
238-
Scene otherScene = new Scene();
239239
for (int i = 0; i < SceneManager.sceneCount; i++)
240240
{
241-
otherScene = SceneManager.GetSceneAt(i);
241+
var otherScene = SceneManager.GetSceneAt(i);
242242
if (otherScene.isLoaded && otherScene != scene)
243243
{
244244
EditorSceneManager.CloseScene(otherScene, false);

Editor/csc.rsp

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
-nowarn:CS0649

Editor/csc.rsp.meta

+7
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

README.md

+12-9
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,30 @@
1-
<h1 align="center">Welcome to com.gameframe.sceneswitcher 👋</h1>
1+
<h1 align="center">Gameframe.SceneSwitcher 👋</h1>
22

33
<!-- BADGE-START -->
4+
[![Codacy Badge](https://app.codacy.com/project/badge/Grade/5e25869cd7c34f218c6483e496038da2)](https://www.codacy.com/manual/coryleach/UnitySceneSwitcher?utm_source=github.com&amp;utm_medium=referral&amp;utm_content=coryleach/UnitySceneSwitcher&amp;utm_campaign=Badge_Grade)
45
![GitHub release (latest by date including pre-releases)](https://img.shields.io/github/v/release/coryleach/UnitySceneSwitcher?include_prereleases)
56
[![openupm](https://img.shields.io/npm/v/com.gameframe.sceneswitcher?label=openupm&registry_uri=https://package.openupm.com)](https://openupm.com/packages/com.gameframe.sceneswitcher/)
67
![GitHub](https://img.shields.io/github/license/coryleach/UnitySceneSwitcher)
78

89
[![twitter](https://img.shields.io/twitter/follow/coryleach.svg?style=social)](https://twitter.com/coryleach)
910
<!-- BADGE-END -->
1011

11-
> Unity editor window for quick scene switching.
12+
Unity editor window for quick scene switching.
1213

1314
## Quick Package Install
1415

1516
#### Using UnityPackageManager (for Unity 2019.3 or later)
1617
Open the package manager window (menu: Window > Package Manager)<br/>
1718
Select "Add package from git URL...", fill in the pop-up with the following link:<br/>
18-
https://github.com/coryleach/UnitySceneSwitcher.git#1.0.1<br/>
19+
https://github.com/coryleach/UnitySceneSwitcher.git#1.0.2<br/>
20+
21+
#### Using UnityPackageManager (for Unity 2019.1 or later)
1922

20-
#### Using UnityPackageManager (for Unity 2018.3 or later)
2123
Find the manifest.json file in the Packages folder of your project and edit it to look like this:
2224
```js
2325
{
2426
"dependencies": {
25-
"com.gameframe.sceneswitcher": "https://github.com/coryleach/UnitySceneSwitcher.git#1.0.1",
27+
"com.gameframe.sceneswitcher": "https://github.com/coryleach/UnitySceneSwitcher.git#1.0.2",
2628
...
2729
},
2830
}
@@ -40,9 +42,9 @@ In the menu select Window -> SceneSwitcher
4042
```
4143
4244
<p align="center">
43-
<img width="250" src="https://github.com/coryleach/UnitySceneSwitcher/blob/master/Documentation~/img/Empty.png" />
44-
<img width="250" src="https://github.com/coryleach/UnitySceneSwitcher/blob/master/Documentation~/img/DefaultMode.png" />
45-
<img width="250" src="https://github.com/coryleach/UnitySceneSwitcher/blob/master/Documentation~/img/EditMode.png" />
45+
<img width="250" src="https://raw.githubusercontent.com/coryleach/UnitySceneSwitcher/master/Documentation~/img/Empty.png" />
46+
<img width="250" src="https://raw.githubusercontent.com/coryleach/UnitySceneSwitcher/master/Documentation~/img/DefaultMode.png" />
47+
<img width="250" src="https://raw.githubusercontent.com/coryleach/UnitySceneSwitcher/master/Documentation~/img/EditMode.png" />
4648
</p>
4749
4850
<p>
@@ -69,9 +71,10 @@ Close = Closes other scenes
6971
* Twitter: [@coryleach](https://twitter.com/coryleach)
7072
* Github: [@coryleach](https://github.com/coryleach)
7173
74+
7275
## Show your support
7376
7477
Give a ⭐️ if this project helped you!
7578
7679
***
77-
_This README was generated with ❤️ by [readme-md-generator](https://github.com/kefranabg/readme-md-generator)_
80+
_This README was generated with ❤️ by [Gameframe.Packages](https://github.com/coryleach/unitypackages)_

package.json

+14-11
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,15 @@
11
{
2-
"name": "com.gameframe.sceneswitcher",
3-
"displayName": "Gameframe.SceneSwitcher",
4-
"version": "1.0.1",
5-
"description": "Unity editor window for quick scene switching.",
6-
"keywords": [],
7-
"author": {
8-
"name": "Cory Leach",
9-
"email": "[email protected]",
10-
"url": "https://github.com/coryleach"
11-
}
12-
}
2+
"name": "com.gameframe.sceneswitcher",
3+
"displayName": "Gameframe.SceneSwitcher",
4+
"version": "1.0.2",
5+
"description": "Unity editor window for quick scene switching.",
6+
"keywords": [],
7+
"author": {
8+
"name": "Cory Leach",
9+
"email": "[email protected]",
10+
"url": "https://github.com/coryleach",
11+
"github": "coryleach",
12+
"twitter": "coryleach"
13+
},
14+
"repositoryName": "UnitySceneSwitcher"
15+
}

0 commit comments

Comments
 (0)