From 27ee0e48a7e051f8292469176780e125c1ebb631 Mon Sep 17 00:00:00 2001 From: Ejlersen Date: Tue, 28 Sep 2021 19:23:46 +0200 Subject: [PATCH] 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) --- Editor/Toolbar/Tools/ToolScenePicker.cs | 65 +------------------------ package.json | 2 +- 2 files changed, 2 insertions(+), 65 deletions(-) diff --git a/Editor/Toolbar/Tools/ToolScenePicker.cs b/Editor/Toolbar/Tools/ToolScenePicker.cs index b852325..ddab564 100644 --- a/Editor/Toolbar/Tools/ToolScenePicker.cs +++ b/Editor/Toolbar/Tools/ToolScenePicker.cs @@ -2,8 +2,6 @@ using System.IO; using JetBrains.Annotations; using UnityEditor; -using UnityEditor.AddressableAssets; -using UnityEditor.AddressableAssets.Settings; using UnityEditor.SceneManagement; using UnityEngine; using UnityEngine.SceneManagement; @@ -30,8 +28,6 @@ namespace Module.NavigationTool.Editor.Tools var listPaths = new List(); InitializeBuildSettingsScenes(listNames, listPaths); - InitializeAssetBundleScenes(listNames, listPaths); - InitializeAddressableScenes(listNames, listPaths); InitializeRemainingScenes(listNames, listPaths); OPTIONS = listNames.ToArray(); @@ -51,70 +47,11 @@ namespace Module.NavigationTool.Editor.Tools if (string.IsNullOrEmpty(scenes[i].path)) continue; - listNames.Add($"{Path.GetFileNameWithoutExtension(scenes[i].path)} \tBuild settings"); + listNames.Add($"{Path.GetFileNameWithoutExtension(scenes[i].path)}"); listPaths.Add(scenes[i].path); } } - - private static void InitializeAssetBundleScenes(List listNames, List 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(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 listNames, List listPaths) - { - var assets = new List(); - 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 listNames, List listPaths) { string[] guids = AssetDatabase.FindAssets("t:scene"); diff --git a/package.json b/package.json index d26f3df..9ee3299 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "com.module.navigationtool", - "version": "0.8.1", + "version": "0.8.2", "displayName": "Module.NavigationTool", "description": "Support for navigation tools, like favorites, history and toolbars", "unity": "2019.2",