Version: 2020.2
iOS-specific optimizations
Optimizing the size of the built iOS Player

Measuring performance with the built-in profiler

Note: The internal profiler is deprecated and will be retired in a future version of Unity. Use the Profiler window instead (menu: Window > Analysis > Profiler).

Unity contains a built-in profiler for iOS and Android. Every 30 frames, the built-in profiler emits console messages from the app running on the device. These messages provide insight into how the app is running. In particular, they help you determine if your app is CPU or GPU-bound. If your app is CPU-bound, you can also determine whether script code or garbage collection are causing the bottleneck. This page details how to configure the built-in profiler.

Here’s an example of the built-in profiler’s output:

iPhone Unity internal profiler stats
frametime>     min: 32.5   max: 34.1   avg: 33.3
cpu-player>    min:  2.2   max:  4.4   avg:  3.7
batches>       min:   3    max:   3    avg:   3
draw calls>    min:   3    max:   3    avg:   3
tris>          min:  1704  max:  1704  avg:  1704
verts>         min:  5088  max:  5088  avg:  5088
dynamic batching> batched draw calls:   0 batches:   0 tris:     0 verts:     0
static batching>  batched draw calls:   0 batches:   0 tris:     0 verts:     0
player-detail> physx:  0.0 animation:  0.0 culling  0.0 skinning:  0.0 batching:  0.0 render:  0.0 fixed-update-count: 0 .. 0
scripting-scripts>  update:  0.0   fixedUpdate:  0.0 coroutines:  0.0 
scripting-memory>   information not available on non-development player configuration

All times are measured in milliseconds per frame. You can see the minimum, maximum, and average times over the last thirty frames.

General CPU activity

Свойство: Функция:
cpu-player Displays the time your app spends executing code inside the Unity engine and executing scripts on the CPU.
cpu-ogles-drv (Android only) Displays the time spent executing OpenGL ES driver code on the CPU. These driver stats can be affected by several factors, including the number of draw calls, number of internal rendering state changes, rendering pipeline setup, and number of processed vertices.
cpu-present (Android only) The amount of time spent executing the presentRenderbuffer command in OpenGL ES.
frametime Represents the overall time of an app frame. Note that iOS hardware is locked at a 60Hz refresh rate, so this property will always return a time that’s a multiple of 16.7ms (1000ms/60Hz = 16.7ms).

Rendering statistics

Свойство: Функция:
tris # Общее количество треугольников, отправленных на рендеринг.
verts # Total number of vertices sent for rendering. You should keep this number below 10000 if your app uses only static geometry. If your app uses many instances of skinned geometry, this number should be much lower.
dynamic/static batching Number of draw-calls, triangles, and vertices that the engine automatically batched. Comparing these numbers with draw-call and triangle totals can give you an idea how well is your scene prepared for batching. Share as many materials as possible among your objects to improve batching.

Detailed Unity Player statistics

The player-detail section provides a detailed breakdown of what’s happening inside the engine:

Свойство: Функция:
physx Время, затраченное на физику.
animation Время, затраченное на анимирование костей.
culling Время, затраченное на отсечение объектов за пределами усечённого вида камеры.
skinning Время, затраченное на анимирование skinned мешей.
batching Time spent batching geometry. Batching dynamic geometry is considerably more resource-intensive than batching static geometry.
render Время, затраченное на рендеринг видимых объектов.
fixed-update-count Минимальное и максимальное количество запущенных FixedUpdate во время этого кадра. Слишком много FixedUpdate заметно ухудшит производительность.

Detailed script statistics

The scripting-scripts section provides a detailed breakdown of the time spent executing code in the Mono runtime:

Свойство: Функция:
update Total time spent executing all Update() methods in scripts.
fixedUpdate Total time spent executing all FixedUpdate() methods in scripts.
coroutines Время, затраченное внутри скриптовых сопрограмм.

Detailed statistics on memory allocated by scripts

The scripting-memory section gives you an idea of how memory is being managed by the Mono garbage collector:

Property: Function:
allocated heap Total amount of memory available for allocations. A garbage collection triggers if the heap doesn’t have enough memory left for a given allocation. If this doesn’t free enough memory, the allocated heap will grow in size.
used heap The portion of the allocated heap which is currently used up by objects. Every time you create a new class instance (not a struct), this number grows until the next garbage collection.
max number of collections Количество проходов сборки мусора во время последних 30-ти кадров.
collection total duration Total time (in milliseconds) of all garbage collection passes that happened during the last 30 frames.


On iOS, the internal profiler is disabled by default. To enable it, open the Unity-generated Xcode project, select the InternalProfiler.h file, and change the line




Alternatively, access the iOS Player Settings (menu: Edit > Project Settings > Player Settings, then select iOS). In the Debugging and crash reporting section, enable the Enable Internal Profiler (Deprecated) setting. Make sure Development Build is enabled in the Build Settings when you build your app.

To display the output console (GDB), select View > Debug Area > Activate Console from Xcode’s main menu, then run your project. Unity then outputs statistics to the console window every 30 frames.

To enable the internal profiler on Android, access the Android Player Settings (menu: Edit > Project Settings > Player Settings, then select Android). In the Optimization section, enable the Enable Internal Profiler (Deprecated) setting. Make sure Development Build is enabled in the Build Settings when you build your app. Statistics will then display in logcat when your app runs on the device. To view logcat, ensure adb or the Android Debug Bridge is installed, and then run the shell command adb logcat.

iOS-specific optimizations
Optimizing the size of the built iOS Player