Deployment size can be critical to your game’s success, especially on mobile or web platforms. Learn about new tools in Unity that help you understand your code and data sizes, give you more control over what ends up in your build, and ultimately, help you reduce the size of your content.
Speaker:
Jonas Echterhoff (Computer Programmer, Unity)
4. Why care about build size?
“For every 6 MB increase to an
APK’s size, we see a decrease in
the install conversion rate of 1%.”
—Sam Tolomei, Google UX
Research
5. Why care about build size?
“The average app APK downloaded in
emerging markets, such as by people in the
Middle East, Africa and South East Asia, are
a quarter of the size of apps downloaded by
people in developed markets, such as in the
US and Western Europe.”
—Sam Tolomei, Google UX Research
6. Why care about build size?
“Shrinking APKs, growing
installs”
https://medium.com/googlepla
ydev/shrinking-apks-growing-
installs-5d3fcba23ce2
7. App store size limits
iOS App Store: 150MB (OTA)
Google Play Store: 100MB
Why care about build size?
8. App store size limits
Google Play Instant: 10MB
Why care about build size?
39. Unity for small things
• Mobile web
• Playable Ads
• Games in messaging Apps
40. Unity for small things
• Core runtime is 72kB compressed
JS
• HTML Canvas
• Use existing Unity Editor and
asset pipeline
Editor's Notes
Bigger builds
-take longer to download,
-use more data to download and
-use more space on the device
iOS: 150MB OTA, larger builds only on WiFi
Google Play: 100 MB, larger builds are possible, but create warnings and bad UX
Google Play instant: 10 MB instant demo in app store. Possible in unity but leaves very little space for actual game play
Simplest way to check build size is to check the size on disk
-You can browse individual files to see sizes of levels, etc
-Android apks can be renamed to zip and unzipped
-iOS is more complicated, check size in iTunes Connect
Editor log file contains a build report with a breakdown of individual asset sizes
See Unity Manual for log file locations
The data in the log comes from a build report object
Some of this data is also available through the new BuildReport editor API in 18.1
I made a Build Report inspect editor script which makes this information more easy to access.
<DEMO TIME>
I will submit this to the A$ so everyone can try it.
I made a Build Report inspect editor script which makes this information more easy to access.
<DEMO TIME>
I will submit this to the A$ so everyone can try it.
Textures are commonly the largest part of asset data
Are all your textures appropriately sized?
You can cap texture size in texture importer
You can use mipmap mode in scene view to get an idea of texture size
Default: platform default compression. Zip on Android. None on standalone builds
LZ4: Fast compression for dev builds
LZ4HC: Slower compression for release builds
Default: platform default compression. Zip on Android. None on standalone builds
LZ4: Fast compression for dev builds
LZ4HC: Slower compression for release builds
Lossy compression for specific asset formats
Meshes: simple quantization. Try different settings until you find one which does not visibly sacrifice quality
Audio: per platform audio compression formats. Ogg Vorbis or other. Compression quality slider.
File size is shown in below the format settings
Textures:
-Different GPU compression formats (DXT/ETC/PVRTC and so on) are created to reduce Video memory footprint while allowing random access to texture data for efficient rendering
-File size is shown in the texture preview
-GPU texture compression is not the most effective way to store textures on disk (compared to eg. JPG)
-Compress textures in a format which minimizes storage on disk, and to allow them to decompress into a GPU compressed format (Texture supercompression)
-Crunch for DXT added to Unity in 5.3
Executable size may be insignificantly contributing to the build size for bigger games, but it is very relevant for small games, as it limits the smallest possible unity game, thus limiting Unity’s use for many platforms with small size constraints (messenger games, playable ads, etc)
Also:
-Cannot defer to Asset Bundles
-Startup time
-Memory
(WebGL!)
Managed code stripping:
-Optional on some mono platforms
-Always enabled on IL2CPP
-Can break reflection
-link.xml whitelists
Native code stripping - strips unused modules from the Unity Engine code itself
-Available on WebGL, Android il2cpp and iOS il2cpp
-Check stripping information in Build Report on which modules have been included and why.
When you see a module is in the build, but not sure how to get rid of it, we now allow you to disable the module:
<DEMO TIME>
Remove physics, show errors, saves 3MB Arm7 executable code
If all of this is not enough…
If all of this is not enough…
Unity editor existing assets
“2018”
2D Canvas
Playable ads
Instant Messaging
Mobile Web
72KB compressed core runtime