I am developing a 2D game for mobile devices. I am using a lot of sprites in my project. My problem is;
-When I build for Android, my apk is around 50 MB which is quite normal.
-When I build for iOS, my build is around 450 MB and when I archive it in Xcode it gets 995 MB. (710, when I disable bitcode.) When I upload to iTunes Connect, it says compressed size is about 230 MB. And it’s size on my iPhone is 530 MB.
I couldn’t understand what is happening there.
Any idea or experience like this?
Edit: I have checked ipa sizes on iTunesConnect once it’s finished processing. Ipa files are around 45 MB, which looks normal but install sizes are around 450 MB. Any ideas on how to decrease sprite sizes? I have ~300 sprites (each one takes 1.3 MB in the build.)
300 sprites with each one being 1.3Mb? That seems huge.
Can you do any compression / packing at all? Can you make them PoT and use PVR compression (the device will thank you for lower memory usage if you can!)?
Aside from compression, there are a few things you should understand about iOS builds.
Firstly, it’s likely that you are generating both the 32bit and 64bit executables. This is as intended and it will therefor make the size slightly larger on iOS.
Secondly, it’s like that the XCode archive includes your dSym files (for de-symbolicating). Again, this is as intended and isn’t going to be part of the downloaded ipa for the player. From the archive you can open the package and extract just the ipa contents to give yourself a better idea of the size without dyms. You can also ask XCode not to generate the dsyms if that helps during testing.
Thirdly, when you upload to apple, the will take the ipa contents, remove the executables, encrypt the contents, re-ad the executables and then compress. Unfortunatly for Unity, this seems to increase the build size quite dramatically. I’m not sure why but I’m guessing the build must contain a lot of contiguous zeros. The rule here is that if the ipa you are uploading is say 80Mb, the download for the player will probably be over 100Mb. It is slightly game specific though.
Fourthly (if that’s as a word), the install size on the device is always much bigger. You’ll note that the first time you run the game on the device the loading time is longer than normal. This is because it’s decompressing.
Unity does publish some general guides on how to reduce build sizes too (stripping, framework usage etc). Might be worth looking through them: Unity - Manual: Optimizing the size of the built iOS Player