@@ -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 ) ;
0 commit comments