0.6.2: Added all scenes to scene picker
This commit is contained in:
parent
2a875eda93
commit
17c55cd03c
|
|
@ -35,10 +35,31 @@ namespace Game.NavigationTool.Editor.Tools
|
|||
if (string.IsNullOrEmpty(scenes[i].path))
|
||||
continue;
|
||||
|
||||
listNames.Add(Path.GetFileNameWithoutExtension(scenes[i].path));
|
||||
listNames.Add($"{Path.GetFileNameWithoutExtension(scenes[i].path)} (Build Settings)");
|
||||
listPaths.Add(scenes[i].path);
|
||||
}
|
||||
|
||||
string[] guids = AssetDatabase.FindAssets("t:scene");
|
||||
int startIndex = listNames.Count;
|
||||
|
||||
for (var i = 0; i < guids.Length; i++)
|
||||
{
|
||||
string path = AssetDatabase.GUIDToAssetPath(guids[i]);
|
||||
var scene = AssetDatabase.LoadAssetAtPath<SceneAsset>(path);
|
||||
|
||||
if (scene == null || listPaths.Contains(path))
|
||||
continue;
|
||||
|
||||
listNames.Add(path.Substring(7, path.Length - 13).Replace('/', '\\'));
|
||||
listPaths.Add(path);
|
||||
}
|
||||
|
||||
if (startIndex < listNames.Count)
|
||||
{
|
||||
listNames.Insert(startIndex, string.Empty);
|
||||
listPaths.Insert(startIndex, string.Empty);
|
||||
}
|
||||
|
||||
OPTIONS = listNames.ToArray();
|
||||
PATHS = listPaths.ToArray();
|
||||
|
||||
|
|
@ -57,8 +78,13 @@ namespace Game.NavigationTool.Editor.Tools
|
|||
Initialize();
|
||||
int temp = EditorGUI.Popup(rect, SELECTED_INDEX, OPTIONS, styles.popup);
|
||||
|
||||
if (temp != -1 && temp != SELECTED_INDEX && OPTIONS.Length != 0)
|
||||
if (temp > -1 && temp != SELECTED_INDEX && OPTIONS.Length != 0)
|
||||
{
|
||||
string path = PATHS[temp];
|
||||
|
||||
if (string.IsNullOrEmpty(path))
|
||||
return;
|
||||
|
||||
SELECTED_INDEX = temp;
|
||||
EditorSceneManager.OpenScene(PATHS[SELECTED_INDEX], OpenSceneMode.Single);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "com.module.navigationtool",
|
||||
"version": "0.6.1",
|
||||
"version": "0.6.2",
|
||||
"displayName": "Module.NavigationTool",
|
||||
"description": "Support for navigation tools, like favorites, history and toolbars",
|
||||
"unity": "2019.2",
|
||||
|
|
|
|||
Loading…
Reference in a new issue