Crunch compression seems to be advertised as a great way to reduce build size.
I’ve made a test on a project that has about 25 atlases which contain almost all sprites I use in the game.
First I noticed the size of an atlas Unity shows without Crunch compression enabled for the atlas, and then I enabled Crunch compression with 100% quality and recorded both size numbers in a GoogleSheet. I did that in atlas default settings without any overrides for other platforms.
I summed up atlas sizes before and after Crunch enabled and got 19696 KB before and 2132 KB after.
That should give the difference of approx 17 MB for the build size, right?
Then I built it for Android and got only 500 KB size difference. Why is that? What about those numbers in the Inspector Unity shows before/after I enable Crunch? This is question one.
Question two is how the compression settings made in an atlas are related to compression settings made in a sprite itself? I did not change sprites’ compression settings during the test, they were set to the following defaults (no overrides for Android):
MaxSize: 2048
Algorithm: Mitchell
Format: Automatic
Compression: Normal Quality
NO crunch compression
Could these settings lead to the weird results I got during the test? Do I need to set compression-related things for each sprite maybe to see the 17MB difference? But then why have those settings for atlases?
I’m using Unity 2020.3.40 btw.
Please help
Leave the original Texture Importer settings of source Sprites as Uncompressed. The textures that are imported along with Sprites are NOT the ones that get built to player if using SpriteAtlas.
Set Compression Settings and other Texture Settings in the SpriteAtlas. Android does support Crunched through
RGBA Crunched ETC2, RGBA Crunched ETC Please use the Override option for Android Targets.
Thanks for the reply and tips but it seems it doesn’t explain the tiny app size difference I got.
If the numbers shown in the inspector for atlas sizes before/after crunch compression are correct then why the app size didn’t change much?
And another thing - why use override for Android if I could just set Crunch checkbox and quality in the Default import settings (as I did)? Would it be any different if I make this setting using Android override?
When looking at size of android build did you compared APK files sizes? APKs are essentially ZIP files with specific folder structure and little bit of Android specific metadata, so they can apply generic binary file compression for all the files inside it. You could test this theory by renaming .APK files to .zip and then comparing unzipped sizes.
Good point. I have AAB, not APK but I followed the principle you described and compared the size of unzipped folders and they are also identical. I’m starting to think Unity somehow enabled crunch compression by default even if it’s not specified, that’s why I had my previous builds of the same size as the new build. Or maybe the inspector is lying about the sizes