Unity场景打包测试记录

测试1:
将多个场景共用的Prefab\FBX\材质\贴图等打包到AssetBundle中,场景打包出的AssetBunlde文件也会依赖这些细分出来的AB.
并且总体的资源大小也会下降.
测试的Manifest如下:

ManifestFileVersion: 0
CRC: 278060267
AssetBundleManifest:
  AssetBundleInfos:
    Info_0:
      Name: test_scene_1.unity3d
      Dependencies:
        Dependency_0: test_prefab_ab.unity3d
    Info_1:
      Name: test_scene_2.unity3d
      Dependencies:
        Dependency_0: test_prefab_ab.unity3d
    Info_2:
      Name: test_scene_3.unity3d
      Dependencies:
        Dependency_0: test_prefab_ab.unity3d
    Info_3:
      Name: test_mat_ab.unity3d
      Dependencies: {}
    Info_4:
      Name: test_prefab_ab.unity3d
      Dependencies:
        Dependency_0: test_mat_ab.unity3d
        Dependency_1: test_fbx_ab.unity3d
    Info_5:
      Name: test_fbx_ab.unity3d
      Dependencies:
        Dependency_0: test_mat_ab.unity3d

测试2:
细分打包的时候,如果只调整材质属性则打包结果只有材质所在AB二进制会有变化,用到该材质的场景打包出的二进制并不会变化.
所以如果做细分打包,可以只比较打包后文件的二进制来比较是否有变化(可以忽略HASH).

测试3:
打包AssetBundle的时候,只提取公共依赖部分把公共依赖部分打成独立的AssetBundle,并记录下最后整个APK大小:339MB.
打包AssetBundle的时候,不仅吧公共依赖部分打成独立的AssetBundle,还把只有被单个AssetBundle依赖的文件也打成独立的AssetBundle(按文件所在目录自动划分),记录下最后整个APK大小:395MB.
对比结果发现细化打包后总包体会变大,网上查了一下应该是Unity内置的资源没有提取出来打成独立的AssetBundle从而使用到的地方都单独包涵了一份(参考这里:https://zhuanlan.zhihu.com/p/25111851).
我想自己参考上面的文章也做一下这样的打包,但是卡在了提取内置资源的那一步,最后放弃了.觉得只提取公共部分也可以满足需求了.如果觉得有些AB包体过大就在打完包后检查下手动拆分体积过大的ab包就可以了.

你可能感兴趣的:(Unity场景打包测试记录)