From 7b5efffaf8c94474cec118849b2946fe2f145bc4 Mon Sep 17 00:00:00 2001 From: Anders Ejlersen Date: Sun, 26 Sep 2021 21:49:40 +0200 Subject: [PATCH] 0.8.1: Fixed issue, where scenes in build settings and addressabels would appear multiple times, due to scenes in build settings automatically being added to addressables --- Editor/Toolbar/Tools/ToolScenePicker.cs | 20 +++++++++++--------- package.json | 2 +- 2 files changed, 12 insertions(+), 10 deletions(-) diff --git a/Editor/Toolbar/Tools/ToolScenePicker.cs b/Editor/Toolbar/Tools/ToolScenePicker.cs index 6fbfbe8..b852325 100644 --- a/Editor/Toolbar/Tools/ToolScenePicker.cs +++ b/Editor/Toolbar/Tools/ToolScenePicker.cs @@ -25,8 +25,7 @@ namespace Module.NavigationTool.Editor.Tools { if (!IS_DIRTY) return; - - EditorBuildSettingsScene[] scenes = EditorBuildSettings.scenes; + var listNames = new List(); var listPaths = new List(); @@ -52,7 +51,7 @@ 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)} \tBuild settings"); listPaths.Add(scenes[i].path); } } @@ -69,16 +68,15 @@ namespace Module.NavigationTool.Editor.Tools for (var j = 0; j < assetPaths.Length; j++) { string path = assetPaths[j]; - - if (listPaths.Contains(path)) - continue; - + var scene = AssetDatabase.LoadAssetAtPath(path); if (scene == null) continue; + if (listPaths.Contains(path)) + continue; - listNames.Add($"{Path.GetFileNameWithoutExtension(path)} \tAsset bundle"); + listNames.Add($"{Path.GetFileNameWithoutExtension(path)} \tAsset bundle"); listPaths.Add(path); } } @@ -102,7 +100,11 @@ namespace Module.NavigationTool.Editor.Tools continue; string path = assets[i].AssetPath; - listNames.Add($"{Path.GetFileNameWithoutExtension(path)} \tAddressable"); + + if (listPaths.Contains(path)) + continue; + + listNames.Add($"{Path.GetFileNameWithoutExtension(path)} \tAddressable"); listPaths.Add(path); } diff --git a/package.json b/package.json index 72e8bdf..d26f3df 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "com.module.navigationtool", - "version": "0.8.0", + "version": "0.8.1", "displayName": "Module.NavigationTool", "description": "Support for navigation tools, like favorites, history and toolbars", "unity": "2019.2",