Search Unity

Unity 5.3.x build size increase FAQ

Discussion in 'iOS and tvOS' started by Mantas-Puida, Feb 2, 2016.

  1. r-pedra

    r-pedra

    Joined:
    Dec 4, 2015
    Posts:
    104
    Apple answered to us 15th of December regarding the huge increase with bitcode since xCode 8 and they told us that they fixed it. We didn't retried at the moment but can someone take a look? Try to submit an app with Bitcode and see if the size decreased
     
  2. Cuicui_Studios

    Cuicui_Studios

    Joined:
    May 3, 2014
    Posts:
    72
    Hi!

    I made a performance test for a new project and there is a quite difference between Unity versions to have in mind. 5.3 is one of the biggest in size but the best on RAM performance. This is a test of a simple scene with some sprites and four copies of this project, each per version, there are no changes with Bitcode.

    Unity 5.3
    22.5 MB RAM 51.8 MB Size
    Unity 5.4
    32.5 MB RAM 54.2 MB Size
    Unity 5.5
    33.4 MB RAM 38 MB Size
    Unity 5.6
    34.5MB RAM 43.1 MB Size

    We can see that Unity´s iOS build system is not much stable and we are going to have performance issues on every version, because if we care about app size you can just jump to 5.5 but then memory crash will appear. Seems like there is not a right version to work in and spend time on optimizing it because a new version will break your work.
     
    MrEsquire likes this.
  3. Dillonion

    Dillonion

    Joined:
    May 21, 2013
    Posts:
    1
    This is still a problem in Unity 5.5. We are having file size issues with builds uploaded to itunes connect so I tested with a brand new empty unity project. Here is the difference with bitcode enabled vs without.

    With Bitcode:
    Screen Shot 2017-01-16 at 9.59.59 AM.png


    Without Bitcode:

    Screen Shot 2017-01-16 at 10.00.30 AM.png

    Building with bitcode doesn't seem to be an option for those of us concerned about the 100 MB download limit.

    This was built using Unity v5.5.0f3 and XCode v8.2.1.
     
    John3D likes this.
  4. Mazyod

    Mazyod

    Joined:
    Apr 21, 2014
    Posts:
    25
    Here are my stats, just for the lulz:

    Unity 5.4.4 IL2Cpp, Xcode 8.2.1, Mono Packages: BestHTTP, Json.NET, NGUI, Anti-cheat Toolkit, I2Loc, Unity Ads + IAP and somewhat minimal C# code base.

    Size on UCB:
    31.04 MB (adhoc distribution)
    203 MB (AppStore distribution)

    Bitcode

    Xcode Archive size: 941 MB





    Without Bitcode



     
    Last edited: Jan 17, 2017
  5. EndOfDayz

    EndOfDayz

    Joined:
    Jun 4, 2014
    Posts:
    2
    We submitted an app that also showed that bloated install size in iTunes Connect for the bitcode build after uploading. But after it showed up in the app store today the download size matched our estimates.

    So for us app thinning seems to work and the estimated app store file sizes in iTunes Connect are WRONG.

    Also Apple seems to always display the size AFTER downloading. This is not the size of the actual download.
     
    Last edited: Jan 19, 2017
  6. halimozturk

    halimozturk

    Joined:
    Dec 1, 2012
    Posts:
    16
    Hi, I am a bit confused about disabling BitCode with the script you gave. Where should I paste it exactly ? I couldn't find post-processing script in my Unity project. If I paste that code in any script I have, is it still going to remove Bitcode ? If not could you please tell the exact location of that particular script.

    Thank you
    Edit: My Unity version is 5.2.1f1 personal, I can't upgrade my unity version for that project because some of my plugins are deprecated after that version of unity
    @David-Berger I am notifying you because I think you can help me too.
     
    Last edited: Feb 1, 2017
  7. Guillaumzed

    Guillaumzed

    Joined:
    Mar 29, 2015
    Posts:
    71
    Same here.
    Just by disabling bitcode in Xcode my compressed build's size went to 54Mo (instead of 178MO before).
    BUT, the actual file size of the downloadable app in the app store remains huge (177Mo)
    (while my android's apk is just 41Mo - the textures are compressed in both cases - Edit : actually that was wrong -)
    Unity 5.5.1f1
     
    Last edited: Feb 11, 2017
  8. Guillaumzed

    Guillaumzed

    Joined:
    Mar 29, 2015
    Posts:
    71
    Ok, maybe I'm too stupid and there's a problem with my compressed textures that wouldn't work on appstore.
    That just a possibility because the editor.log tells me the sum of all the uncompressed textures's size is 133Mo. That's precisely what's too much in the final app's size.
    Working on it.
     
  9. Mantas-Puida

    Mantas-Puida

    Joined:
    Nov 13, 2008
    Posts:
    1,864
    App Store app shows install size instead of download size.
    That's why uncompressed texture make big impact on it.
     
    skwanny likes this.
  10. -Aymeric-

    -Aymeric-

    Joined:
    Oct 21, 2014
    Posts:
    110
    Yes, they are install size... but it doesn't explain the differences between APK and IPA (install size). With other tech like Adobe AIR, using pure PNGs without compression doesn't show any issue in contrast to Unity.

    And it doesn't explain how a 60Mo IPA results into a 300Mo installed binary on the device.

    So please, just tell us the correct settings to use in Xcode?
     
  11. Guillaumzed

    Guillaumzed

    Joined:
    Mar 29, 2015
    Posts:
    71
    So this is my final story about this.

    EndofDayz was Right :
    "So for us app thinning seems to work and the estimated app store file sizes in iTunes Connect are WRONG."

    I had 3 problems :

    1) 10 uncompressed textures that were equal to 100Mo in the final ipa size. (I've found that out by reading the editor.log after the build in Unity)
    2) 10 ASTC compressed textures were not working in iphones and were uncompressed behind my back (I've found it out by reading the logs while testing the app on Iphone in XCode).
    3) Itunes connect estimated app store file sizes are wrong and I thought that bitcode had to be turned OFF to have a lower estimated size. Actually, Apple may strip your app properly AFTER the review, so you can keep it ON. (I say "may" because my app is still 70Mo on iphones (it's still 20Mo too much) but I can't try another review process right now with bitcode off again - and for information, the WRONG itunes connect estimated size for that release was 110Mo with bitcode on and for iphones!)
     
    Last edited: Feb 20, 2017
  12. Carl201010

    Carl201010

    Joined:
    Jan 21, 2016
    Posts:
    16
    I'm about to go down the thinning route but I have to say the info I'm getting from iTunes Connect seems confusing to put it mildly. As an ad-hoc distribution I get an IPA of 65.9Mb, as App Store IPA it comes in at a whopping 204.7Mb. When I upload to iTunes Connect I'm told the compressed file size is 139Mb, which is too big of course but seems reducible within the realms of thinning.

    However, when I look at the App Store File Sizes I'm seeing an indication of a Universal build size of 818Mb! Now, I've just gone through and manually checked every uncompressed PNG atlas in the project from the file system and the total is 71.6Mb. If the PVRTC estimates in the editor are to be believed though these compress down to a total of 28.7Mb. Is it simply that the TestFlight estimates are wrong? If not - where am I adding 750Mb to my project?

    Clearly I'm missing something; can anyone please show me the error of my ways? :)
     
  13. Carl201010

    Carl201010

    Joined:
    Jan 21, 2016
    Posts:
    16
    Just to follow this one up with a thought; After going back through the assets, of course I found where the issue was; some of the atlases required PVRTC to be set explicitly in override for iOS for some reason. This brought the app size down to nearer 170Mb. So still chunky, but closer. I tried a couple of tests, but found that the thing that really made a difference was turning off symbols and bitcode in the Xcode archiver. Without these the app was 45Mb. Debug symbols, as Mantas-Puida pointed out, take up a lot of space, but when I re-included bitcode I saw the app size grow to ~105 Mb.

    As Guillaumzed and EndofDayz point out, app thinning seems to be the inevitable approach, but one thing bugs me; bitcode seems to be an addition made primarily for Apple's convenience, and it inevitably increases file sizes. The real issue is with the over-the-air delivery size, as iTunes Connect estimates do indeed seem to be spurious. Would it hurt Apple to increase the over-the-air size limit as a consequence? This size limit was primarily targeted at 3G devices and takes into consideration phone contract rates probably more indicative of 2012 - 2013 (my guesstimate). Me, I use 3 and pay £20 per month for a sim with unlimited data, and there are many similar deals out there. Would it not save a lot of messing around if Apple just played fair and increased the OTA limit to say 200Mb? (This isn't an Apple-rant, as far as I'm concerned the assistant in the Kingston branch who replaced my laptop charger for free when it was obvious the cat had chewed through the cable pretty much walks-on-water, so I have no axe to grind with big-fruit Co.). But wouldn't it just make more sense ? #JustAskin' ;)
     
  14. SCS_Dani

    SCS_Dani

    Joined:
    May 28, 2012
    Posts:
    55
    In our case, our IPA file size is 138 MB but installed is 2.75GB!! On PC, resources.resS file is 950MB. On Android size is correct. Chcking editor.log, the biggest file is only 6MB. The whole Resources folder is 30MB...

    We are really lost and this really importat as we can't launch a title that its install size is 2.75GB
     
  15. SCS_Dani

    SCS_Dani

    Joined:
    May 28, 2012
    Posts:
    55
    We opened the .resS file (950MB) with HEX Editor and we see that the whole file is almost the same values repeated lot of times. Values like

    ff ff ff ff 00 00 00 00
    aa aa aa aa 00 00 00 00

    If we compress to a zip the file, compressed is only 8MB...
     
  16. MrEsquire

    MrEsquire

    Joined:
    Nov 5, 2013
    Posts:
    2,712
    So what does this mean, you found a Unity bug?

    Also what version of Unity are you using?
     
  17. SCS_Dani

    SCS_Dani

    Joined:
    May 28, 2012
    Posts:
    55
    No, I don't think so :p Only that the file includes a lot of things uncompressed and repeated making the file much bigger.

    5.5.2f1
     
  18. SCS_Dani

    SCS_Dani

    Joined:
    May 28, 2012
    Posts:
    55
    Ok... more news. We changed texture compression to "ASTC 6x6 Block" and our installed size now is 326MB (much better than 2,7GB)...
     
  19. p0w1nd

    p0w1nd

    Joined:
    Oct 28, 2015
    Posts:
    140
    My game is also facing this issue.

    Android build is ~54 MB:
    https://play.google.com/store/apps/details?id=com.channel4.fancycats

    But iOS build is 250 MB (viewing on my iPad Air's App Store app)
    https://itunes.apple.com/us/app/fancy-cats-match-3-puzzle-kitty-dressup/id1116046099?mt=8

    In another game we're currently developing, I have this info from Editor.log (iOS plaftform):

    And the APK is about ~32 MB, while on iOS it is:

    170 MB compressed file size
    > 350 MB Estimated App Store file size

    What's wrong here? :confused:

    I'm using Unity 5.5.1f
     
    Last edited: Apr 3, 2017
  20. Mantas-Puida

    Mantas-Puida

    Joined:
    Nov 13, 2008
    Posts:
    1,864
    I made analysis of your apps on Google Play Store and Apple App Store.
    Download size:
    Play Store: 46 MB (apk) + 55 MB (obb) = ~101 MB
    App Store: 76.3 MB (ipa) (Note: App Store nowadays shows estimated install size, not the download size)

    Install size:
    Android: 46 MB APK (zipped) + 22 MB extracted libs + 55 MB obb (zipped) + 9 MB OAT (extracted classlibs) = ~ 132 MB (device actually reports 129 MB)
    iOS: 248 MB, because all the assets are extracted during the installation, matches what App Store shows as estimate.

    So major difference is because Android keeps assets zipped (higher cost when starting app, but less need for disk space). I also compared what is size of data folders inside of Android archives:

    Data inside APK : 94 MB + Data inside of OBB archive: 191 MB = 285 MB
    Data inside iOS installation: 207 MB, smaller value is semi-expected because for Android each asset is serialized as separate file to optimize performance when loading from zip archive, which has more overhead.

    iOS additionally has:
    - 30 MB application executable (comparable to the extracted libs portion on Android)
    - 9 MB of iOS splash screens. To minimize size of them it's recommended to not use legacy launch images, but rather use Launch Images (limiting size of graphics used, maybe even setting to none).
     
    ImbaGame and p0w1nd like this.
  21. FaunaGames

    FaunaGames

    Joined:
    Mar 23, 2017
    Posts:
    5
    So, what is the best practice at the end of the day.

    Best Regards,
     
  22. Mantas-Puida

    Mantas-Puida

    Joined:
    Nov 13, 2008
    Posts:
    1,864
    Are you interested in download size or install size optimizations? Are you ready to sacrifice some loading performance? Depending to the answers to questions above different strategies might work best.
     
  23. DBarlok

    DBarlok

    Joined:
    Apr 24, 2013
    Posts:
    268
    Why is that? I have many textures inside the project...i suspected something like this maybe is happening too. I will try this week. APK, 97mb, IPA, 384mb, lol.
     
  24. DBarlok

    DBarlok

    Joined:
    Apr 24, 2013
    Posts:
    268
    Hello, before i start to find why my APK published is 97mb and my IPA in GetInfo from OS desktop is saying 384 mb (same if i upload to Diawwi), can you answer to me if the Override IOS PVTRC is working? Thank you Mantas..sorry my hurry up english. I readed all of the above but i suspect i keep with unstable info here. Can you help me please ? I need to send build this week....
     
  25. DBarlok

    DBarlok

    Joined:
    Apr 24, 2013
    Posts:
    268
    Other thing is keeping me stuck and scratching my head is this. The final IPA now with XCode Enable Bytecode disabled, is saying 134mb with GetInfo (i processed it with Itunes and drag it to desktop). Now, i go to Unity log and im seeing this with textures, is this possible? In Android build, the textures are 70%, compressed, in the log and goes to 70mb or similar. This is Unity 5.5 log switched to IOS after this build of 134mb, i still have more size than APK but i suspect there are things inside the IPA that will be taked out in App Store? Sorry, im new to IOS build.

    Textures 1.3 mb 1.9%
    Meshes 10.9 mb 16.1%
    Animations 6.9 mb 10.2%
    Sounds 10.0 mb 14.7%
    Shaders 354.5 kb 0.5%
    Other Assets 2.0 mb 3.0%
    Levels 26.5 mb 39.3%
    Scripts 3.1 mb 4.5%
    Included DLLs 6.4 mb 9.5%
    File headers 145.6 kb 0.2%
    Complete size 67.6 mb 100.0%


    How all textures are in 1.3mb? Lol, im super confused now...
     
    Last edited: May 23, 2017
  26. DBarlok

    DBarlok

    Joined:
    Apr 24, 2013
    Posts:
    268
    Where i can read about this strategies? Thanks.
     
    Moonjump likes this.
  27. DBarlok

    DBarlok

    Joined:
    Apr 24, 2013
    Posts:
    268
    ....iOS additionally has:
    - 30 MB application executable (comparable to the extracted libs portion on Android)
    - 9 MB of iOS splash screens. To minimize size of them it's recommended to not use legacy launch images, but rather use Launch Images (limiting size of graphics used, maybe even setting to none)....

    So, what i need to do? APK in Android is 94mb (published and alive) and IPA in Desktop proccesed with iTunes is 134mb (i made builds that went to 384mb but i suspect is Bytecode when i forgot to disable it, for now...). There's something i can do BEFORE sending for IOS review to thin this 34mb out to reach the 100mb to over the air? Or i need to switch to Asset Bundle? Super difficult to switch from Android to IOS i see now...I readed that no one has a clue of the final IPA size, just estimated playing with TestFlight or other Info...is there one simple answer to all of this? I feel like Sherlock Holmes since last week to reach this thread. I will simplify this post in just one later, sorry, but im running to reach deadline. Now, when i upload IPA to Diawi, the IPA that has 134mb, Diawi says it is 128.3mb.....:eek: Now, if i put GetInfo inside iTunes, it says this 128.3mb. Ok. Still, i dont get why 30mb of difference with executable. It's a lot of frameworks...

    https://forum.unity3d.com/threads/ios-app-size-app-slicing-and-comparison-to-android.429244/

    https://forum.unity3d.com/threads/ios-app-size-vastly-larger-than-android.317601/
     
    Last edited: May 23, 2017
  28. fidelsoto

    fidelsoto

    Joined:
    Aug 7, 2012
    Posts:
    87
    I followed the instructions here:
    https://support.unity3d.com/hc/en-us/articles/207942813-How-to-disable-Bitcode-support-

    So basically I have an editor script called "DisableBitcode" (Its on an Editor folder inside the Assets folder).

    Code (CSharp):
    1. using System.Collections.Generic;
    2. using UnityEngine;
    3. using UnityEditor;
    4. using UnityEditor.Callbacks;
    5. using UnityEditor.iOS.Xcode;
    6.  
    7. public static class MyBuildPostprocess
    8. {
    9.     [PostProcessBuild(999)]
    10.     public static void OnPostProcessBuild( BuildTarget buildTarget, string path)
    11.     {
    12.         if(buildTarget == BuildTarget.iOS)
    13.         {
    14.             string projectPath = path + "/Unity-iPhone.xcodeproj/project.pbxproj";
    15.  
    16.             PBXProject pbxProject = new PBXProject();
    17.             pbxProject.ReadFromFile(projectPath);
    18.  
    19.             string target = pbxProject.TargetGuidByName("Unity-iPhone");      
    20.             pbxProject.SetBuildProperty(target, "ENABLE_BITCODE", "NO");
    21.  
    22.             pbxProject.WriteToFile (projectPath);
    23.         }
    24.     }
    25. }
    Building the project in Unity Cloud Build yields a 109mb .ipa which turns into 532.9mb when released to the AppStore.
    Why?!

    Why is the install size 560mb?
     
    Last edited: Jun 15, 2018
  29. fidelsoto

    fidelsoto

    Joined:
    Aug 7, 2012
    Posts:
    87
    I disabled bitcode and compressed my textures.
    I don't understand whats taking all the space. Why is complete size 593mb?