0.8.2: Removed scene listing for addressables, since it is too expensive (~220 times worse, then just running through entire asset database for scenes)
This commit is contained in:
parent
7b5efffaf8
commit
27ee0e48a7
|
|
@ -2,8 +2,6 @@
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using JetBrains.Annotations;
|
using JetBrains.Annotations;
|
||||||
using UnityEditor;
|
using UnityEditor;
|
||||||
using UnityEditor.AddressableAssets;
|
|
||||||
using UnityEditor.AddressableAssets.Settings;
|
|
||||||
using UnityEditor.SceneManagement;
|
using UnityEditor.SceneManagement;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
using UnityEngine.SceneManagement;
|
using UnityEngine.SceneManagement;
|
||||||
|
|
@ -30,8 +28,6 @@ namespace Module.NavigationTool.Editor.Tools
|
||||||
var listPaths = new List<string>();
|
var listPaths = new List<string>();
|
||||||
|
|
||||||
InitializeBuildSettingsScenes(listNames, listPaths);
|
InitializeBuildSettingsScenes(listNames, listPaths);
|
||||||
InitializeAssetBundleScenes(listNames, listPaths);
|
|
||||||
InitializeAddressableScenes(listNames, listPaths);
|
|
||||||
InitializeRemainingScenes(listNames, listPaths);
|
InitializeRemainingScenes(listNames, listPaths);
|
||||||
|
|
||||||
OPTIONS = listNames.ToArray();
|
OPTIONS = listNames.ToArray();
|
||||||
|
|
@ -51,70 +47,11 @@ namespace Module.NavigationTool.Editor.Tools
|
||||||
if (string.IsNullOrEmpty(scenes[i].path))
|
if (string.IsNullOrEmpty(scenes[i].path))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
listNames.Add($"{Path.GetFileNameWithoutExtension(scenes[i].path)} \tBuild settings");
|
listNames.Add($"{Path.GetFileNameWithoutExtension(scenes[i].path)}");
|
||||||
listPaths.Add(scenes[i].path);
|
listPaths.Add(scenes[i].path);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void InitializeAssetBundleScenes(List<string> listNames, List<string> listPaths)
|
|
||||||
{
|
|
||||||
string[] bundleNames = AssetDatabase.GetAllAssetBundleNames();
|
|
||||||
int startIndex = listNames.Count;
|
|
||||||
|
|
||||||
for (var i = 0; i < bundleNames.Length; i++)
|
|
||||||
{
|
|
||||||
string[] assetPaths = AssetDatabase.GetAssetPathsFromAssetBundle(bundleNames[i]);
|
|
||||||
|
|
||||||
for (var j = 0; j < assetPaths.Length; j++)
|
|
||||||
{
|
|
||||||
string path = assetPaths[j];
|
|
||||||
|
|
||||||
var scene = AssetDatabase.LoadAssetAtPath<SceneAsset>(path);
|
|
||||||
|
|
||||||
if (scene == null)
|
|
||||||
continue;
|
|
||||||
if (listPaths.Contains(path))
|
|
||||||
continue;
|
|
||||||
|
|
||||||
listNames.Add($"{Path.GetFileNameWithoutExtension(path)} \tAsset bundle");
|
|
||||||
listPaths.Add(path);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (startIndex >= listNames.Count)
|
|
||||||
return;
|
|
||||||
|
|
||||||
listNames.Insert(startIndex, string.Empty);
|
|
||||||
listPaths.Insert(startIndex, string.Empty);
|
|
||||||
}
|
|
||||||
|
|
||||||
private static void InitializeAddressableScenes(List<string> listNames, List<string> listPaths)
|
|
||||||
{
|
|
||||||
var assets = new List<AddressableAssetEntry>();
|
|
||||||
AddressableAssetSettingsDefaultObject.Settings.GetAllAssets(assets, false);
|
|
||||||
int startIndex = listNames.Count;
|
|
||||||
|
|
||||||
for (var i = 0; i < assets.Count; i++)
|
|
||||||
{
|
|
||||||
if (!(assets[i].MainAsset is SceneAsset))
|
|
||||||
continue;
|
|
||||||
|
|
||||||
string path = assets[i].AssetPath;
|
|
||||||
|
|
||||||
if (listPaths.Contains(path))
|
|
||||||
continue;
|
|
||||||
|
|
||||||
listNames.Add($"{Path.GetFileNameWithoutExtension(path)} \tAddressable");
|
|
||||||
listPaths.Add(path);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (startIndex >= listNames.Count)
|
|
||||||
return;
|
|
||||||
|
|
||||||
listNames.Insert(startIndex, string.Empty);
|
|
||||||
listPaths.Insert(startIndex, string.Empty);
|
|
||||||
}
|
|
||||||
|
|
||||||
private static void InitializeRemainingScenes(List<string> listNames, List<string> listPaths)
|
private static void InitializeRemainingScenes(List<string> listNames, List<string> listPaths)
|
||||||
{
|
{
|
||||||
string[] guids = AssetDatabase.FindAssets("t:scene");
|
string[] guids = AssetDatabase.FindAssets("t:scene");
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "com.module.navigationtool",
|
"name": "com.module.navigationtool",
|
||||||
"version": "0.8.1",
|
"version": "0.8.2",
|
||||||
"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