Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice
  3. Join us on November 16th, 2023, between 1 pm and 9 pm CET for Ask the Experts Online on Discord and on Unity Discussions.
    Dismiss Notice

iOS build file size

Discussion in 'Editor & General Support' started by keijo486, May 22, 2017.

  1. keijo486

    keijo486

    Joined:
    Feb 16, 2013
    Posts:
    3
    I am developing a game. In android the file size is about 100 MB but in iOS although Bitcode is disabled the file size remains about 250 MB. How can I reduce the file size? Also, I have textures in my Assets and Resources folder which take about 40 MB, but when I look at the editor log in Unity it says that textures take about 130 MB in the iOS build file. How is that possible? Also why editor log shows the percentages of Textures, Shaders, Scripts and other files as NaN% (not a number) and inf% (infinity) instead of normal percentages?
     
  2. thedarcsage

    thedarcsage

    Joined:
    Nov 2, 2016
    Posts:
    23
    I have the same question as well. It is a 31 mb .apk for Android, but it is listed as 273 mb on the Apple App store. I am still searching and reading up on this, but this is one thread I have found.

    Edit: Here's a reference to another thread on this subject matter - https://forum.unity3d.com/threads/how-to-reduce-size-and-increase-speed-of-unity-ios-build.405475/

    And from the Unity Manual:

    Checking Editor log for file sizes:
    https://docs.unity3d.com/Manual/ReducingFilesize.html

    https://docs.unity3d.com/Manual/iphone-playerSizeOptimization.html
    In it, this is one of the sections:
     
    Last edited: May 25, 2017
  3. larku

    larku

    Joined:
    Mar 14, 2013
    Posts:
    1,422
    Here's some key points that may explain a little:

    Your assets are likely PNG/JPG etc - these compress well. Unity converts these to a different format for the target platform. On iOS you'll likely have true colour (uncompressed) which is a LOT larger than their PNG/JPG counterparts. Or if you're using compression it'll be PVRTC (https://docs.unity3d.com/Manual/class-TextureImporterIos.html) which does not offer the same compression ratios as PNG/JPG.

    This is also similar for Android (except it'll be some variant of ETC rather than PVRTC).

    On iOS your output (IPA) is signed and encrypted before it's compressed. Encrypted data has the same characteristics as random data in that it does not compress well.

    On Android the entire apk is a zip file that compresses better because it's not encrypted prior to compression.

    So Android gets better compression for the final output.

    iOS also includes a lot of bits to support various iOS devices - these are sometimes stripped out by iTunes so the eventual download is smaller. Upload/submit it to iTunes connect and it'll show you the actual download size for the different devices. The final IPA size you see is not the end actual download size.

    There's a lot of information, blog posts and forum posts that go over this, have a good search around and you'll find lots of helpful info.

    Here's my quick 'n dirty list for where I'd start.

    • Limit use of true colour (uncompressed) textures - every bit counts here.
    • Reduce your audio a LOT, go 22khz 8bit mono if you can :) just make sure it's acceptable when listened to.. every bit counts here too.
    • Use atlases to reduce your texture footprint
    • Distribute the big bits with asset bundles if possible - more fiddly but reduces the initial size.
    • Only include architectures you need in Xcode (typically only armv7 and arm64)
    There's likely a number of other things I've missed here, but it's a start!

    Good luck.
     
    Soulside and VasiliyMyrza like this.
  4. yoambulante

    yoambulante

    Joined:
    Feb 3, 2017
    Posts:
    4
    i am very annoyed with this... if you simply archive in xcode and make a .ipa (adhoc) it can be up to x4 smaller. In my case, after optimisations my game is 41MB (adhoc) then after submitted at the store it is 108MB! wtf!?!? so, my only one conclusion here is... GOD KNOWS what your final filesize is going to be after Apple encryption.
     
  5. larku

    larku

    Joined:
    Mar 14, 2013
    Posts:
    1,422
    Did you read the post above yours? It explains most of what's going on.
     
  6. jtok4j

    jtok4j

    Joined:
    Dec 6, 2013
    Posts:
    320
    One helpful tip for textures optimization would be to "Build and Run" using an ios device attached to the computer.
    Then you can change the textures to a level (or two) lower in size/compression, and actually look at your target device to see if the extra pixels you omitted by changing "Max Size" in the texture's properties, has actually made a noticeable difference.
    For textures which are on objects less than 10% of the screen size, those extra pixels you can cut out would never have showed on the screen in the end anyway.
    Keep on Creating!