From 9b4abf86b6f0eeadf4085b4da7d9bb835544090e Mon Sep 17 00:00:00 2001 From: hevinci Date: Wed, 9 Aug 2023 20:15:55 +0800 Subject: [PATCH] update runtime code MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 可寻址模式默认支持通过资源路径加载。 --- .../Internal/DeserializeManifestOperation.cs | 23 +++++++++---------- 1 file changed, 11 insertions(+), 12 deletions(-) diff --git a/Assets/YooAsset/Runtime/PackageSystem/Operations/Internal/DeserializeManifestOperation.cs b/Assets/YooAsset/Runtime/PackageSystem/Operations/Internal/DeserializeManifestOperation.cs index 51deab9..c45da5e 100644 --- a/Assets/YooAsset/Runtime/PackageSystem/Operations/Internal/DeserializeManifestOperation.cs +++ b/Assets/YooAsset/Runtime/PackageSystem/Operations/Internal/DeserializeManifestOperation.cs @@ -97,7 +97,7 @@ namespace YooAsset Manifest.AssetDic = new Dictionary(_packageAssetCount); if (Manifest.EnableAddressable) - Manifest.AssetPathMapping1 = new Dictionary(_packageAssetCount); + Manifest.AssetPathMapping1 = new Dictionary(_packageAssetCount * 3); else Manifest.AssetPathMapping1 = new Dictionary(_packageAssetCount * 2); @@ -130,15 +130,6 @@ namespace YooAsset Manifest.AssetDic.Add(assetPath, packageAsset); // 填充AssetPathMapping1 - if (Manifest.EnableAddressable) - { - string location = packageAsset.Address; - if (Manifest.AssetPathMapping1.ContainsKey(location)) - throw new System.Exception($"Address have existed : {location}"); - else - Manifest.AssetPathMapping1.Add(location, packageAsset.AssetPath); - } - else { string location = packageAsset.AssetPath; if (Manifest.LocationToLower) @@ -146,7 +137,7 @@ namespace YooAsset // 添加原生路径的映射 if (Manifest.AssetPathMapping1.ContainsKey(location)) - throw new System.Exception($"AssetPath have existed : {location}"); + throw new System.Exception($"Location have existed : {location}"); else Manifest.AssetPathMapping1.Add(location, packageAsset.AssetPath); @@ -155,11 +146,19 @@ namespace YooAsset { string locationWithoutExtension = PathUtility.RemoveExtension(location); if (Manifest.AssetPathMapping1.ContainsKey(locationWithoutExtension)) - YooLogger.Warning($"AssetPath have existed : {locationWithoutExtension}"); + YooLogger.Warning($"Location have existed : {locationWithoutExtension}"); else Manifest.AssetPathMapping1.Add(locationWithoutExtension, packageAsset.AssetPath); } } + if (Manifest.EnableAddressable) + { + string location = packageAsset.Address; + if (Manifest.AssetPathMapping1.ContainsKey(location)) + throw new System.Exception($"Location have existed : {location}"); + else + Manifest.AssetPathMapping1.Add(location, packageAsset.AssetPath); + } // 填充AssetPathMapping2 if (Manifest.IncludeAssetGUID)