Version: 2019.2
Measuring performance with the built-in profiler
Optimizing Physics Performance

Optimizing the size of the built iOS Player

The two main ways of reducing the size of the Player are by making a proper Release build within Xcode and by changing the Stripping Level within Unity.

Building for distribution

It is expected that final release builds are made using the Xcode command Product > Archive. Using this command ensures that build is made with release configuration and all the debug symbols are stripped. After issuing this command, Xcode switches to the Organizer window Archives tab. For guidelines on how to calculate app size and other size-reducing tips, see Apple’s Technical Q&A on Reducing the size of my App.

Note: We recommend you have some small extra margin for error when aiming for an over-the-air download limit (which currently is 150MB).

iOS stripping level

Activate the size optimizations for Mono scripting backendA framework that powers scripting in Unity. Unity supports three different scripting backends depending on target platform: Mono, .NET and IL2CPP. Universal Windows Platform, however, supports only two: .NET and IL2CPP. More info
See in Glossary
builds by stripping work in the following way:

  1. Strip assemblies level: the scriptsA piece of code that allows you to create your own Components, trigger game events, modify Component properties over time and respond to user input in any way you like. More info
    See in Glossary
    ’ bytecode is analyzed so that classes and methods that are not referenced from the scripts can be removed from the DLLs and thereby excluded from the AOT compilation phase. This optimization reduces the size of the main binary and accompanying DLLs and is safe as long as no reflection is used.

  2. Strip ByteCode level: any .NET DLLs (stored in the Data folder) are stripped down to metadata only. This is possible because all the code is already precompiled during the AOT phase and linked into the main binary.

  3. Use micro mscorlib level: a special, smaller version of mscorlib is used. Some components are removed from this library, for example, Security, Reflection.Emit, Remoting, non Gregorian calendars, etc. Also, interdependencies between internal components are minimized. This optimization reduces the main binary and mscorlib.dll size but it is not compatible with some System and System.Xml assembly classes, so use it with care.

These levels are cumulative, so level 3 optimization implicitly includes levels 2 and 1, while level 2 optimization includes level 1.

Note that Micro mscorlib is a heavily stripped-down version of the core library. Only those items that are required by the Mono runtime in Unity remain. Best practice for using micro mscorlib is not to use any classes or other features of .NET that are not required by your application. GUIDs are a good example of something you could omit; they can easily be replaced with custom made pseudo GUIDs and doing this would result in better performance and app size.

Stripping with IL2CPP

Refer to documentation on managed bytecode stripping with IL2CPP for more information

Note: It can sometimes be difficult to determine which classes are getting stripped in error even though the application requires them. You can often get useful information about this by running the stripped application on the simulator and checking the Xcode console for error messages.

Simple checklist for making your distribution as small as possible

  1. Minimize your assets: enable compressionA method of storing data that reduces the amount of storage space it requires. See Texture Compression, Animation Compression, Audio Compression, Build Compression.
    See in Glossary
    for textures and reduce their resolution as far as possible. Also, minimize the number of uncompressed sounds. There are some additional tips for file size reduction here.
  2. On Mono, set the iOS Stripping Level to Use micro mscorlib, or on IL2CPPA Unity-developed scripting back-end which you can use as an alternative to Mono when building Projects for some platforms. More info
    See in Glossary
    enable Strip Engine Code.
  3. Set the script call optimization level to Fast but no exceptions.
  4. Don’t use anything that lives in System.dll or System.Xml.dll in your code. These libraries are not compatible with micro mscorlib.
  5. Remove unnecessary code dependencies.
  6. Set the API Compatibility Level to .Net 2.0 subset. Note that .Net 2.0 subset has limited compatibility with other libraries.
  7. Avoid generic containers in combination with value types, including structs.

How small can an app be made with Unity?

An empty project would take less than 22 MB in the App Store if all the size optimizations were turned off. With code stripping, the empty sceneA Scene contains the environments and menus of your game. Think of each unique Scene file as a unique level. In each Scene, you place your environments, obstacles, and decorations, essentially designing and building your game in pieces. More info
See in Glossary
with just the main cameraA component which creates an image of a particular viewpoint in your scene. The output is either drawn to the screen or captured as a texture. More info
See in Glossary
can be reduced to less than 12 MB in the App Store (zipped and DRM attached).

Why did my app increase in size after being released to the App Store?

When publishing your app, Apple App Store service first encrypts the binary file and then compresses it via zip. Encryption increases ’‘randomness’ of the code segment and thus makes it worse for compression. Check “Building for distribution” chapter above how to estimate App Store size before submission.


  • 2018–06–14 Page amended

  • 2017–14–06 - Upated Stripping with IL2CPP section

Measuring performance with the built-in profiler
Optimizing Physics Performance
Copyright © 2023 Unity Technologies
优美缔软件(上海)有限公司 版权所有
"Unity"、Unity 徽标及其他 Unity 商标是 Unity Technologies 或其附属机构在美国及其他地区的商标或注册商标。其他名称或品牌是其各自所有者的商标。
公安部备案号:
31010902002961