Unity Packing Volume Optimization
Recently, I read some articles about Unity volume optimization solutions and Unity’s official doc to summarize
Resource optimization
- Compress the image size, reduce the size of the texture with low accuracy requirements, and select the appropriate compression algorithm according to the needs of the platform.
- Turn off picture minimap and A channel.
- Sprite Atlas (formerly Sprite Packer), which packages multiple maps into one map
Mesh Optimization: Set Mesh Compression to Low, Medium or High - Use Prefab instead of scenes
- Use Addressable to unpack resources to CDN download
Code optimization
- Set iOS Stripping Level to Use micro mscorlib__ on Mono or enable Strip Engine Code on IL2CPP
- IL2CPP Enable Managed Code Stripping
- Do not use the System.dll method (this method requires refactoring the code to replace all used places)
- Remove unnecessary code dependencies
- API Compatibility Level 选择 .NET Standard 2.0
Packaging optimization
General purpose
- Turn off static resource pooling
- Packaged version selection Release
- Build Settings Compression Method Release时选择LZ4HC
Android
- If not necessary, reduce the supported architectures of Android (for each additional architecture, an additional set of symbol tables will be added, and 50 + MB will be extracted)
- Publish Settings Launch Minify
Product optimization
iOS
- Close bitcode
Reference article
- https://www.cnblogs.com/wxjblog/p/14038849.html
- https://blog.csdn.net/dengshunhao/article/details/84834596
- Optimize build size of iOS player: https://docs.unity3d.com/cn/2020.3/Manual/iphone-playerSizeOptimization.html
- iOS Player Settings: https://docs.unity3d.com/cn/2020.3/Manual/class-PlayerSettingsiOS.html#scriptCallOpt
- iOS Build Settings: https://docs.unity3d.com/cn/2020.3/Manual/BuildSettingsiOS.html
- Android Player Settings: https://docs.unity3d.com/cn/2020.3/Manual/class-PlayerSettingsAndroid.html