1.3.1: Removing all package scenes from ScenePicker, due to read-only scenes not being loadable
This commit is contained in:
parent
c54a325cfe
commit
21cd509506
|
|
@ -1,4 +1,5 @@
|
||||||
using System.Collections.Generic;
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using JetBrains.Annotations;
|
using JetBrains.Annotations;
|
||||||
using UnityEditor;
|
using UnityEditor;
|
||||||
|
|
@ -65,13 +66,18 @@ namespace Module.NavigationTool.Editor.Toolbar
|
||||||
|
|
||||||
if (listPaths.Contains(path))
|
if (listPaths.Contains(path))
|
||||||
continue;
|
continue;
|
||||||
|
if (!path.StartsWith("Assets"))
|
||||||
|
continue;
|
||||||
|
|
||||||
var scene = AssetDatabase.LoadAssetAtPath<SceneAsset>(path);
|
var scene = AssetDatabase.LoadAssetAtPath<SceneAsset>(path);
|
||||||
|
|
||||||
if (scene == null)
|
if (scene == null)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
listNames.Add(path.Substring(7, path.Length - 13).Replace('/', '\\'));
|
string sceneName = path.Substring(7, path.Length - 13)
|
||||||
|
.Replace('/', '\\');
|
||||||
|
|
||||||
|
listNames.Add(sceneName);
|
||||||
listPaths.Add(path);
|
listPaths.Add(path);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -91,16 +97,22 @@ namespace Module.NavigationTool.Editor.Toolbar
|
||||||
{
|
{
|
||||||
Initialize();
|
Initialize();
|
||||||
int temp = EditorGUI.Popup(rect, SELECTED_INDEX, OPTIONS, styles.popup);
|
int temp = EditorGUI.Popup(rect, SELECTED_INDEX, OPTIONS, styles.popup);
|
||||||
|
|
||||||
if (temp > -1 && temp != SELECTED_INDEX && OPTIONS.Length != 0)
|
|
||||||
{
|
|
||||||
string path = PATHS[temp];
|
|
||||||
|
|
||||||
if (string.IsNullOrEmpty(path))
|
if (temp <= -1 || temp == SELECTED_INDEX || OPTIONS.Length == 0)
|
||||||
return;
|
return;
|
||||||
|
if (string.IsNullOrEmpty(PATHS[temp]))
|
||||||
SELECTED_INDEX = temp;
|
return;
|
||||||
EditorSceneManager.OpenScene(PATHS[SELECTED_INDEX], OpenSceneMode.Single);
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
Scene scene = EditorSceneManager.OpenScene(PATHS[temp], OpenSceneMode.Single);
|
||||||
|
|
||||||
|
if (scene.isLoaded)
|
||||||
|
SELECTED_INDEX = temp;
|
||||||
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
Debug.LogWarningFormat("Failed to load scene ({0}), due to exception: {1}", PATHS[temp], e.Message);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -13,7 +13,8 @@ namespace Module.NavigationTool.Editor.Toolbar
|
||||||
|
|
||||||
private static bool HasChange(string[] assets)
|
private static bool HasChange(string[] assets)
|
||||||
{
|
{
|
||||||
return assets.Any(s => s.EndsWith(".unity")) || assets.Any(s => s.EndsWith("EditorBuildSettings.asset"));
|
return assets.Any(s => s.EndsWith(".unity")) ||
|
||||||
|
assets.Any(s => s.EndsWith("EditorBuildSettings.asset"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "com.module.navigationtool",
|
"name": "com.module.navigationtool",
|
||||||
"version": "1.3.0",
|
"version": "1.3.1",
|
||||||
"displayName": "Module.NavigationTool",
|
"displayName": "Module.NavigationTool",
|
||||||
"description": "Support for navigation tools, like favorites, history and toolbars",
|
"description": "Support for navigation tools, like favorites, history and toolbars",
|
||||||
"unity": "2019.2",
|
"unity": "2019.2",
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue