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 size is larger than it should be

Discussion in 'iOS and tvOS' started by Abdou23, Dec 9, 2016.

  1. Abdou23

    Abdou23

    Joined:
    May 2, 2014
    Posts:
    77
    I did some google search but haven't found a specific answer for this. Here you can see that a project with only 2 sprites in it is supposed to be 4.8MB:



    The unity project itself: 114
    The Xcode build(from unity): 809
    The IPA file: 137
    The app on my iPhone (through Xcode): 38.2

    If I understand correctly the combined sizes of all the files in my project are 4.8, so I would like to know how a 4.8 project turned out to be 38.2 on my phone? And is there a way to make those sizes much less and more representative of the actual project size, especially the IPA file which is the one that gets uploaded to the Appstore.
    Also, I'd like to know given the above data, what is the size of the file that gets uploaded to the Cloud build.
     
  2. christophergoy

    christophergoy

    Unity Technologies

    Joined:
    Sep 16, 2015
    Posts:
    735
    Hi @Abdou23,
    There are a number of factors that can make your app size larger. One thing I don't see in that build report is the size of the unity library. If you are building with a debug configuration, this library will be larger because you are including debug symbols into it. If you build with a release configuration you will probably see a smaller app size in general.

    There is also an entire thread dedicated to the discussion of bit code and how it impacts your app size which can be found here: https://forum.unity3d.com/threads/unity-5-3-x-build-size-increase-faq.383533/

    As well as articles
    https://support.unity3d.com/hc/en-us/articles/209933103-Bitcode-Support-in-iOS-tvOS
    https://support.unity3d.com/hc/en-u...ng-iOS-tvOS-apps-with-app-thinning-and-IL2CPP
    https://support.unity3d.com/hc/en-us/articles/208412186-IL2CPP-build-size-optimizations

    Let me know if you have further questions.
    Cheers,
    Chris
     
  3. Abdou23

    Abdou23

    Joined:
    May 2, 2014
    Posts:
    77
    @christophergoy
    Thanks for the reply.
    I checked all the links you provided and it seems that the entire problem is down to the "Bitcode" being enabled by default. I added the script to my project and indeed it made a difference although not very huge when it came to the size of the app on the phone which is now (21.9 MB) and still larger than it should be. I have the same project made with Corona SDK and it's 4.8 MB on my phone.

    The exported Xcode project is 710 MB, which is huge, so I checked and found a file called "libiPhone-lib.a" that alone is 603 MB. it's under a folder called "Libraries":
    "Xcode-Project/Libraries/libiPhone-lib.a"
    I'm not sure what this file is and if I should just delete it, and if I can, why is it in there by default? and if I can't, again, why?

    I understand that "Bitcode" allows Apple to optimize the app later to support different screen sizes or ios versions and I would like to know if disabling it is the right way to go, and is there any other way to enable it but keep the project & app sizes reasonably small. I also would like to know why aren't this option is available in "Player Settings".

    Apologies for the long post and that many questions that I have, but it just that a year ago I tried "unity3d" and despite it being a very great and fast engine for developing games, I faced several issues with it when it came to publishing the project. Now I'm back to it and it seems that most issues are still there.
    So, I was wondering are the engineers behind "unity3d" aware of those issues and working on making it much simpler better, and more efficient than it is?

    Not to make comparisons, but one thing I loved about Corona SDK is that you can build and upload an IOS app without even having to open Xcode, and the projects there have much more logical sizes.

    Thank you.
     
  4. christophergoy

    christophergoy

    Unity Technologies

    Joined:
    Sep 16, 2015
    Posts:
    735
    Hey @Abdou23,
    libiPhone-lib.a is so large because it contains the compiled unity library for every available iPhone architecture, including the simulator for 32 and 64 bit platforms. When you build your app, only the architecture you are building for will be used, and the rest will be stripped away by Xcode.

    One thing you can do, if you want your project size to more accurately reflect what you put into your project, is to check the 'Symlink Unity libraries' toggle in the build settings window.

    I don't think disabling bitcode will get you any size benefit. Apple will use it to compile your app for the different architectures that exist, and the app you download from the app store will be smaller than what you originally uploaded. Why it's not in player settings for iOS, I'm not sure. I will ask. For tvOS, it is required.

    Being able to upload an app through unity sounds like an interesting feature that I will bring up to our team. Our initial thinking was that since we generate an xcode project, it would be logical for users to be able to upload the app themselves. Though, now that you've brought this up, I can see value in being able to do this with a button click in unity. Though users will have to do some extra setup in order for unity to do this correct.

    Thanks for you feedback. I will get back to you with some answers soon.
    Cheers,
    Chris
     
  5. Abdou23

    Abdou23

    Joined:
    May 2, 2014
    Posts:
    77
    @christophergoy
    Thank you again, Christopher, for taking the time to answer me.

    I strongly recommend that the team at unity give more attention to this issue, as you know, sometimes the only way to properly test your project is by using an actual phone, sometimes it needs to be done 5 or 6 times in a matter of minutes when you are tweaking some values, but with the current setup where we have to wait for unity to build a huge file, then Xcode to again, build and archive that file it's a very tedious, slow and painful process.
    Please, explore that matter and try to make it much easier and faster in the future.
     
  6. r618

    r618

    Joined:
    Jan 19, 2009
    Posts:
    1,272
    @christophergoy please don't do that
    you'll introduce another dependency on rather fragile apple dev stack where app uploader can be updated / changed any time without notice
    exposing Xcode project parameter/s is rather sufficient way to customize Xcode project - everything else down the road I'd leave to whatever the current Apple way of doing thing is.

    ( just to be clear: I'm talking just about the uploading application directly from unity )
     
  7. christophergoy

    christophergoy

    Unity Technologies

    Joined:
    Sep 16, 2015
    Posts:
    735
    Hey @r618,
    I agree that it could be a fragile addition to unity. I haven't commit to doing anything, yet, I do think it's an interesting use case that's worth investigating. Allowing some users to upload an app with a button click would not replace the export process we currently have. I imagine it would be an optional way to upload an app.
    Cheers,
    Chris
     
  8. mealone

    mealone

    Joined:
    Feb 17, 2014
    Posts:
    4
    Can anybody help me? This seems to be a major disparity .... why is it so huge after installation?
     

    Attached Files: