如何减少 Unity 包的大小

How to reduce bundle size Unity

在 Unity 中减少 Android App Bundle 大小的一些技巧是什么?

有什么方法可以在 10MB 以内完成吗?

我有 33.4MB 的 apk。这是编辑日志:

Build Report
Uncompressed usage by category (Percentages based on user generated assets only):
Textures               1.4 mb    6.8% 
Meshes                 0.0 kb    0.0% 
Animations             102.1 kb  0.5% 
Sounds                 152.2 kb  0.7% 
Shaders                130.5 kb  0.6% 
Other Assets           1.8 mb    9.0% 
Levels                 1.9 mb    9.5% 
Scripts                1.0 mb    5.2% 
Included DLLs          13.3 mb   66.4% 
File headers           270.7 kb  1.3% 
Total User Assets      20.0 mb   100.0% 
Complete build size    109.4 mb

提示

为了在 Unity 中减少 Android 的 APK 或 App Bundle 大小,这里有一些提示:

  • 使用 ETC(ETC 或 ETC2)或 DXT 压缩(Crunched RGBA 用于透明图像,RGB 用于纯色背景)压缩图像和纹理
  • 压缩音频文件(在内存中压缩)
  • 从包管理器中删除未使用的包
  • 从资产中删除未使用的插件
  • 从资产中减少资源中的文件

更多信息在这里:https://docs.unity3d.com/Manual/ReducingFilesize.html

资产包

我更喜欢使用称为 AssetBundle 的资源包。创建起来非常容易,然后将其上传到 public 服务器。最后,在你的Unity项目中你必须下载它,解压然后使用它。

AssetsBundle中的所有资源都可以从项目中删除。此解决方案用于 Google Instant App for Unity。

更多信息在这里:https://docs.unity3d.com/Manual/AssetBundlesIntro.html