问题:
假设我们有3个AssetBundle,分别是A、B、C。他们的依赖关系是A依赖B、B依赖C。那么当我们打包后,通过Manifest去读取A的依赖文件清单时,是否会有C呢?
结论:
有
代码:
[MenuItem("Test/BuildAB")]
public static void Build()
{
Directory.CreateDirectory("AssetBundles");
var manifest = BuildPipeline.BuildAssetBundles("AssetBundles", BuildAssetBundleOptions.ChunkBasedCompression, EditorUserBuildSettings.activeBuildTarget);
foreach(var ab in manifest.GetAllAssetBundles())
{
//Debug.Log($"[{ab}] 依赖的文件:");
var depends = manifest.GetAllDependencies(ab);
foreach(var depend in depends)
{
Debug.Log($"[{ab}] 依赖文件: {depend}");
}
}
Debug.Log($"Over");
}
输出:
image.png
网友评论