From d4480262500eb1615e8a74fb3fbc19091815faaa Mon Sep 17 00:00:00 2001 From: hevinci Date: Thu, 25 May 2023 16:38:02 +0800 Subject: [PATCH] update AssetBundleBuilder MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 修复了内置着色器Tag未正确传染给依赖资源包的问题。 --- .../BuildTasks/TaskCreateManifest.cs | 20 +++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/Assets/YooAsset/Editor/AssetBundleBuilder/BuildTasks/TaskCreateManifest.cs b/Assets/YooAsset/Editor/AssetBundleBuilder/BuildTasks/TaskCreateManifest.cs index 310e36f..1299b29 100644 --- a/Assets/YooAsset/Editor/AssetBundleBuilder/BuildTasks/TaskCreateManifest.cs +++ b/Assets/YooAsset/Editor/AssetBundleBuilder/BuildTasks/TaskCreateManifest.cs @@ -205,6 +205,7 @@ namespace YooAsset.Editor throw new Exception("没有发现着色器资源包!"); // 检测依赖交集并更新依赖ID + HashSet tagTemps = new HashSet(); foreach (var packageAsset in manifest.AssetList) { List dependBundles = GetPackageAssetAllDependBundles(manifest, packageAsset); @@ -215,8 +216,23 @@ namespace YooAsset.Editor if (newDependIDs.Contains(shaderBundleId) == false) newDependIDs.Add(shaderBundleId); packageAsset.DependIDs = newDependIDs.ToArray(); + foreach (var tag in packageAsset.AssetTags) + { + if (tagTemps.Contains(tag) == false) + tagTemps.Add(tag); + } } } + + // 更新资源包标签 + var packageBundle = manifest.BundleList[shaderBundleId]; + List newTags = new List(packageBundle.Tags); + foreach (var tag in tagTemps) + { + if (newTags.Contains(tag) == false) + newTags.Add(tag); + } + packageBundle.Tags = newTags.ToArray(); } private List GetPackageAssetAllDependBundles(PackageManifest manifest, PackageAsset packageAsset) { @@ -302,7 +318,7 @@ namespace YooAsset.Editor { if (packageBundle.IsRawFile) { - _cachedBundleDepends.Add(packageBundle.BundleName, new string[] { } ); + _cachedBundleDepends.Add(packageBundle.BundleName, new string[] { }); continue; } @@ -321,7 +337,7 @@ namespace YooAsset.Editor } EditorTools.ClearProgressBar(); } - + private int[] GetBundleRefrenceIDs(PackageManifest manifest, PackageBundle targetBundle) { List referenceList = new List();