Fixed special case where the dependent bundle list contained the main bundle

修复了特殊情况下依赖的资源包列表里包含主资源包的问题
pull/4/head
hevinci 2022-04-13 17:00:14 +08:00
parent 89bde69417
commit eb6b6e3aba
1 changed files with 7 additions and 4 deletions

View File

@ -116,13 +116,13 @@ namespace YooAsset.Editor
PatchAsset patchAsset = new PatchAsset(); PatchAsset patchAsset = new PatchAsset();
patchAsset.AssetPath = assetInfo.AssetPath; patchAsset.AssetPath = assetInfo.AssetPath;
patchAsset.BundleID = GetAssetBundleID(assetInfo.BundleName, patchManifest); patchAsset.BundleID = GetAssetBundleID(assetInfo.BundleName, patchManifest);
patchAsset.DependIDs = GetAssetBundleDependIDs(assetInfo, patchManifest); patchAsset.DependIDs = GetAssetBundleDependIDs(patchAsset.BundleID, assetInfo, patchManifest);
result.Add(patchAsset); result.Add(patchAsset);
} }
} }
return result; return result;
} }
private int[] GetAssetBundleDependIDs(BuildAssetInfo assetInfo, PatchManifest patchManifest) private int[] GetAssetBundleDependIDs(int mainBundleID, BuildAssetInfo assetInfo, PatchManifest patchManifest)
{ {
List<int> result = new List<int>(); List<int> result = new List<int>();
foreach (var dependAssetInfo in assetInfo.AllDependAssetInfos) foreach (var dependAssetInfo in assetInfo.AllDependAssetInfos)
@ -130,8 +130,11 @@ namespace YooAsset.Editor
if (dependAssetInfo.BundleNameIsValid() == false) if (dependAssetInfo.BundleNameIsValid() == false)
continue; continue;
int bundleID = GetAssetBundleID(dependAssetInfo.BundleName, patchManifest); int bundleID = GetAssetBundleID(dependAssetInfo.BundleName, patchManifest);
if (result.Contains(bundleID) == false) if (mainBundleID != bundleID)
result.Add(bundleID); {
if (result.Contains(bundleID) == false)
result.Add(bundleID);
}
} }
return result.ToArray(); return result.ToArray();
} }