Search Unity

iOS build sizes

Discussion in 'iOS and tvOS' started by jdeuce, Apr 26, 2018.

  1. jdeuce

    jdeuce

    Joined:
    Dec 15, 2012
    Posts:
    22
    Hey guys I just released my game "Finger Jets" to iOS and Android.

    The android build is less than 50 mb, but the iOS build is more like 230mb.

    Is that normal? Does anyone else have a multi platform build? What is the expected size difference with 2017.4?

    I've looked through this https://docs.unity3d.com/Manual/iphone-playerSizeOptimization.html but since I'm using IL2CPP there aren't really any tips I can see to action.

    Same with https://docs.unity3d.com/Manual/ReducingFilesize.html, it talks about using .NET 2.0 which I can't seem to set. Is that still an option in 2018? My project is using 4.6 and won't seem to let me go lower. I am using the System.xml.dll it mentions but it says that only adds like 1mb which I'm not really worried about.

    The build statistics don't really say where most of the usage is coming from, it seems to be missing 90% of the data:

    Code (csharp):
    1. 22781: [Unity] Build Report
    2. 22782: [Unity] Uncompressed usage by category:
    3. 22783: [Unity] Textures      77.7 mb     10.4%
    4. 22784: [Unity] Meshes        0.0 kb     0.0%
    5. 22785: [Unity] Animations    95.4 kb     0.0%
    6. 22786: [Unity] Sounds        1.9 mb     0.3%
    7. 22787: [Unity] Shaders       964.0 kb     0.1%
    8. 22788: [Unity] Other Assets  707.1 kb     0.1%
    9. 22789: [Unity] Levels        10.5 mb     1.4%
    10. 22790: [Unity] Scripts       402.0 kb     0.1%
    11. 22791: [Unity] Included DLLs 329.5 kb     0.0%
    12. 22792: [Unity] File headers  116.3 kb     0.0%
    13. 22793: [Unity] Complete size 750.0 mb     100.0%
    There's obviously some opportunity to reduce usage from textures, but I feel like that's not going to give me the big win I'm looking for , not sure where else to start looking.
     
    Last edited: Apr 26, 2018
    eladleb4 likes this.
  2. jdeuce

    jdeuce

    Joined:
    Dec 15, 2012
    Posts:
    22
    I did a test with an empty project, with literally nothing in it but 1 empty scene.

    Built on Unity Cloud Build with 2017.4.1

    Code (csharp):
    1.  
    2. 1054: [Unity] Build Report
    3. 1055: [Unity] Uncompressed usage by category:
    4. 1056: [Unity] Textures      0.0 kb     0.0%
    5. 1057: [Unity] Meshes        0.0 kb     0.0%
    6. 1058: [Unity] Animations    0.0 kb     0.0%
    7. 1059: [Unity] Sounds        0.0 kb     0.0%
    8. 1060: [Unity] Shaders       16.4 kb     0.0%
    9. 1061: [Unity] Other Assets  1.8 kb     0.0%
    10. 1062: [Unity] Levels        5.0 kb     0.0%
    11. 1063: [Unity] Scripts       659.0 kb     0.1%
    12. 1064: [Unity] Included DLLs 0.0 kb     0.0%
    13. 1065: [Unity] File headers  17.0 kb     0.0%
    14. 1066: [Unity] Complete size 584.7 mb     100.0%
    15.  
    Final output size: 138.4 mb

    So you take that with my textures and it's pretty close.

    Default player settings of Scripting Runtime .NET 3.5 with api compatiblity level .NET 2.0 subset.

    But 138 mb for an empty scene? Is that really the bare minimum? Those other docs were saying it was like 22mb.

    EDIT: Same project on latest 2018.2 goes up to 147.47mb
     
    Last edited: Apr 27, 2018
  3. jdeuce

    jdeuce

    Joined:
    Dec 15, 2012
    Posts:
    22
    Guess these big build sizes are expected.
     
  4. GeorgeCH

    GeorgeCH

    Joined:
    Oct 5, 2016
    Posts:
    222
    There's a world of difference between the build size that Unity spits out and the eventual final iOS build that is deployed on the device before compilation.

    In my case, Unity produces a 950mb iOS build that, when released to the app store, is only around 70mb. In contrast, the Android build is around 50mb. So don't panic until you've actually compiled the app and tested it via Testflight.

    P.S. I don't know anything about your game, but 70mb can be a lot for textures. Are you using sprite atlases and, if yes, are you compressing them?
     
    _protagonist likes this.
  5. jdeuce

    jdeuce

    Joined:
    Dec 15, 2012
    Posts:
    22
    My 235mb build output is on the store and only went down to like 195mb , when the android is only 45mb
     
  6. GeorgeCH

    GeorgeCH

    Joined:
    Oct 5, 2016
    Posts:
    222
    I'd suggest using texture compression and see where that gets you. I used 2017.2 to launch my first game, and that one I could get down to 60-75mb, depending on how much compression-related loss I was willing to tolerate. In other words, 150mb is definitely not the minimum size.

    I set the scripting runtime to 4.x-equivalent, backend to IL2CPP, minimum iOS version to 8.0, and script call optimization to "fast but no exceptions".
     
  7. Jonas_Sid

    Jonas_Sid

    Mobile Graphics Developer Unity Technologies

    Joined:
    May 13, 2015
    Posts:
    44
    hi!

    you can calculate more accurate build size using the steps in paragraph
    Getting an App Size Report here. This is as accurate number as you can get without publishing
     
    Moonjump likes this.
  8. samizzo

    samizzo

    Joined:
    Sep 7, 2011
    Posts:
    487
    Those build statistics are clearly wrong though. Those sizes don't add up to the complete size, and the percentages don't add up to 100%. The log should look something like this:
    Code (CSharp):
    1. Textures      32.8 mb     76.6%
    2. Meshes        0.0 kb      0.0%
    3. Animations    160.6 kb    0.4%
    4. Sounds        1.6 mb      3.7%
    5. Shaders       55.2 kb     0.1%
    6. Other Assets  2.6 mb      6.1%
    7. Levels        387.2 kb    0.9%
    8. Scripts       1.2 mb      2.8%
    9. Included DLLs 3.9 mb      9.2%
    10. File headers  75.7 kb     0.2%
    11. Complete size 42.8 mb     100.0%
    Maybe there's something wrong with how UCB reports that information from the log? You could try building for iOS on your own machine if you have a Mac.

    -Sam
     
  9. eladleb4

    eladleb4

    Joined:
    Apr 25, 2016
    Posts:
    57
    I'm seeing the same issue, after moving from Mono to IL2CPP we have a 70mb Android .apk and a 130MB (App store compressed size). The extracted size is 300MB and that is what is shown on the App Store page :(
     
  10. lukos

    lukos

    Joined:
    Nov 11, 2012
    Posts:
    22
    @jonassid There is a serious issue with Current LTS version 2017.4

    I have invested some time to compare my project. Here are logs for 2017.4 LTS vs 2017.2.0p3 There is a 0.5GB difference on same project.

    size on 2017.2.0p3 - 237.1 mb
    size on 2017.4.0f10 LTS - 887.5 mb

    https://postimg.cc/gallery/2iujcvh76/



    over 500mb from thin air. Editor log does not indicate where this extra build size is coming from
     
    eladleb4 likes this.
  11. Xiexm56

    Xiexm56

    Joined:
    Apr 9, 2018
    Posts:
    6
    I have the same issue that the listed category size in total is not equal to the completed size. The percentage sum up is not equal to 100% either. The difference is around 600MB. Does any one know what could this 600MB be?
    Cheers
     

    Attached Files:

  12. rmjfox

    rmjfox

    Joined:
    Jun 4, 2018
    Posts:
    9
    Same issue.

    iOS -
    Code (CSharp):
    1.  
    2. Build Report
    3. Uncompressed usage by category:
    4. Textures 17.0 mb 2.7%
    5. Meshes 0.0 kb 0.0%
    6. Animations 4.9 kb 0.0%
    7. Sounds 547.9 kb 0.1%
    8. Shaders 15.6 kb 0.0%
    9. Other Assets 237.0 kb 0.0%
    10. Levels 63.2 kb 0.0%
    11. Scripts 399.6 kb 0.1%
    12. Included DLLs 0.0 kb 0.0%
    13. File headers 28.0 kb 0.0%
    14. Complete size 632.2 mb 100.0%
    Tried building with empty project as well, yet the complete size was over 600 MB!
    Unity Version - Unity 2018.1.0f2 Personal(64bit)
    Building on mac.
     
  13. rmjfox

    rmjfox

    Joined:
    Jun 4, 2018
    Posts:
    9
  14. umair_hassan1991

    umair_hassan1991

    Joined:
    Jun 27, 2018
    Posts:
    18
    Just set Compression Method to LZ4HC & see the magic. It compress almost 100 MB of build size.
    Thanks me later. ;)
    upload_2019-12-12_16-52-27.png
     
    kikasik and davitsedrakian like this.
  15. lostminds

    lostminds

    Joined:
    Jan 17, 2019
    Posts:
    51
    Hello, I've been having similar problems with Unity 2019 iOS builds (up to the latest 2019.3.0f3, using URP).
    https://forum.unity.com/threads/tips-for-reducing-finished-ios-app-size.755615/
    https://forum.unity.com/threads/sti...ine-shaders-and-textures-on-ios-build.787823/

    As far as I've figured it out there seem to be a couple of problems we're currently seeing at the same time:
    - Unity seems to add a lot of extra stuff, bloating the build report size, that then goes away when repackaging and recompressing the app in XCode. So the total build size in the build report for iOS builds doesn't seem to really matter, or reflect anything useful. Though the asset type totals etc are still useful.
    - On top of this it seems that Unity is failing to strip some unused resources linked to the new render pipeline and including them in the build and actually affecting the end size (internal shaders and textures), which now makes the base size of a finished app about 50MB instead of the 22MB cited in the documentation. Not sure if this is intentional/expected or a bug.
     
  16. rainboltk

    rainboltk

    Joined:
    Feb 17, 2018
    Posts:
    3
    Still having trouble with this in 2019.2.9f1

    Don't quite understand where this file size is coming from:

    Build Report
    Uncompressed usage by category (Percentages based on user generated assets only):
    Textures 11.6 mb 50.2%
    Meshes 0.0 kb 0.0%
    Animations 4.0 kb 0.0%
    Sounds 0.0 kb 0.0%
    Shaders 36.4 kb 0.2%
    Other Assets 7.0 mb 30.5%
    Levels 95.0 kb 0.4%
    Scripts 600.9 kb 2.5%
    Included DLLs 3.7 mb 16.1%
    File headers 41.6 kb 0.2%
    Total User Assets 23.1 mb 100.0%
    Complete build size 910.1 mb

    The math on this doesn't add up. In the build, the Libraries\libiPhone-lib.a is nearly 600MB on it's own. I am building in Release with LZ4HC enabled.

    I understand the resulting app will be smaller, but I am attempting to use Visual Studio App Center to build, which requires the project to be in a Git branch. A 500+MB file does not jive with most source control systems.

    Any thoughts?