From d560d8a2e82bb164a8b4a619980d806759887bea Mon Sep 17 00:00:00 2001 From: hevinci Date: Mon, 25 Sep 2023 18:37:49 +0800 Subject: [PATCH] update asset bundle collector --- .../Editor/AssetBundleCollector/AssetBundleCollector.cs | 2 ++ .../AssetBundleCollector/AssetBundleCollectorGroup.cs | 3 +++ .../AssetBundleCollector/AssetBundleCollectorPackage.cs | 3 +++ .../AssetBundleCollectorSettingData.cs | 3 ++- .../DefaultRules/DefaultAddressRule.cs | 9 +++++++++ 5 files changed, 19 insertions(+), 1 deletion(-) diff --git a/Assets/YooAsset/Editor/AssetBundleCollector/AssetBundleCollector.cs b/Assets/YooAsset/Editor/AssetBundleCollector/AssetBundleCollector.cs index 7c3a90a..3ea00a1 100644 --- a/Assets/YooAsset/Editor/AssetBundleCollector/AssetBundleCollector.cs +++ b/Assets/YooAsset/Editor/AssetBundleCollector/AssetBundleCollector.cs @@ -193,6 +193,8 @@ namespace YooAsset.Editor { string address = collectInfoPair.Value.Address; string assetPath = collectInfoPair.Value.AssetPath; + if (string.IsNullOrEmpty(address)) + continue; if (address.StartsWith("Assets/") || address.StartsWith("assets/")) throw new Exception($"The address can not set asset path in collector : {CollectPath} \nAssetPath: {assetPath}"); diff --git a/Assets/YooAsset/Editor/AssetBundleCollector/AssetBundleCollectorGroup.cs b/Assets/YooAsset/Editor/AssetBundleCollector/AssetBundleCollectorGroup.cs index 2818c77..152a4ab 100644 --- a/Assets/YooAsset/Editor/AssetBundleCollector/AssetBundleCollectorGroup.cs +++ b/Assets/YooAsset/Editor/AssetBundleCollector/AssetBundleCollectorGroup.cs @@ -103,6 +103,9 @@ namespace YooAsset.Editor { string address = collectInfoPair.Value.Address; string assetPath = collectInfoPair.Value.AssetPath; + if (string.IsNullOrEmpty(address)) + continue; + if (addressTemper.TryGetValue(address, out var existed) == false) addressTemper.Add(address, assetPath); else diff --git a/Assets/YooAsset/Editor/AssetBundleCollector/AssetBundleCollectorPackage.cs b/Assets/YooAsset/Editor/AssetBundleCollector/AssetBundleCollectorPackage.cs index 684a6e9..0a7cc1b 100644 --- a/Assets/YooAsset/Editor/AssetBundleCollector/AssetBundleCollectorPackage.cs +++ b/Assets/YooAsset/Editor/AssetBundleCollector/AssetBundleCollectorPackage.cs @@ -103,6 +103,9 @@ namespace YooAsset.Editor { string address = collectInfoPair.Value.Address; string assetPath = collectInfoPair.Value.AssetPath; + if (string.IsNullOrEmpty(address)) + continue; + if (addressTemper.TryGetValue(address, out var existed) == false) addressTemper.Add(address, assetPath); else diff --git a/Assets/YooAsset/Editor/AssetBundleCollector/AssetBundleCollectorSettingData.cs b/Assets/YooAsset/Editor/AssetBundleCollector/AssetBundleCollectorSettingData.cs index 5cf40b3..29b9e3f 100644 --- a/Assets/YooAsset/Editor/AssetBundleCollector/AssetBundleCollectorSettingData.cs +++ b/Assets/YooAsset/Editor/AssetBundleCollector/AssetBundleCollectorSettingData.cs @@ -94,7 +94,8 @@ namespace YooAsset.Editor typeof(AddressByFileName), typeof(AddressByFilePath), typeof(AddressByFolderAndFileName), - typeof(AddressByGroupAndFileName) + typeof(AddressByGroupAndFileName), + typeof(AddressDisable) }; var customTypes = EditorTools.GetAssignableTypes(typeof(IAddressRule)); diff --git a/Assets/YooAsset/Editor/AssetBundleCollector/DefaultRules/DefaultAddressRule.cs b/Assets/YooAsset/Editor/AssetBundleCollector/DefaultRules/DefaultAddressRule.cs index 8cde379..0a32e81 100644 --- a/Assets/YooAsset/Editor/AssetBundleCollector/DefaultRules/DefaultAddressRule.cs +++ b/Assets/YooAsset/Editor/AssetBundleCollector/DefaultRules/DefaultAddressRule.cs @@ -2,6 +2,15 @@ namespace YooAsset.Editor { + [DisplayName("定位地址: 禁用")] + public class AddressDisable : IAddressRule + { + string IAddressRule.GetAssetAddress(AddressRuleData data) + { + return string.Empty; + } + } + [DisplayName("定位地址: 文件名")] public class AddressByFileName : IAddressRule {