Version: 2018.2
Optimizing Performance on iOS
Measuring performance with the built-in profiler

iOS-specific optimizations

This page details optimizations that are unique to iOS deployment.

Script call optimization

Most of the functions in the UnityEngine namespace are implemented in C/C++. Calling a C/C++ function from a Mono script involves a performance overhead, so you can save about 1 to 4 milliseconds per frame using iOS Script Call optimization.

To access iOS Script Call optimization, navigate to the Player Settings window (menu: Edit > Project Settings > Player) and select the iOS icon (shown below).

iOS Icon - select this to access the iOS settings in the Player Settings window
iOS Icon - select this to access the iOS settings in the Player Settings window

Locate the Script Call Optimization setting in the _Other Settings section.

The options for this setting are:-

  • Slow and Safe - the default Mono internal call handling with exception support.
  • Fast but no exceptions - a faster implementation of Mono internal call handling. However, this doesn’t support exceptions and so should be used with caution. An app that doesn’t explicitly handle exceptions (and doesn’t need to deal with them gracefully) is an ideal candidate for this option.

Note: There is no performance benefit when using the IL2CPP scripting backend. However, we recommend using Fast but no exceptions on release builds to avoid undefined behaviour.

Setting the frame rate

Unity iOS позволяет вам выбрать частоту, с которой ваше приложение попытается выполнять процесс рендеринга. По умолчанию она равна 30-ти кадрaм в секунду. Вы можете понизить это число, чтобы уменьшить скорость разряда аккумулятора, но это, разумеется, будет ценой обновления кадров. И наоборот, вы можете увеличить частоту кадров, чтобы дать рендерингу приоритет над другими процессами, вроде сенсора или работы акселерометра. Вам придётся поэкспериментировать с выбором желаемой частоты кадров, чтобы определить, как в вашем случае это будет влиять на игровой процесс.

Если ваше приложение включает в себя много вычислений или рендеринга и может обрабатывать только 15 кадров в секунду, то установка желаемой частоты кадров выше 15, не даст дополнительной производительности. Приложение должно быть достаточно оптимизировано для высокой частоты кадров.

To set the desired frame rate, change Application.targetFrameRate.

Tuning accelerometer processing frequency

Если акселерометр выдаёт данные чаще слишком часто, то производительность вашей игры может пострадать. По умолчания, Unity iOS приложение будет брать данные с акселерометра 60 раз в секунду. Вы можете немного увеличить производительность уменьшив частоту снятия данных с акселерометра, а для игр, которые его не используют, можно и вовсе установить её на ноль. Вы можете изменить частоту работы акселерометра, используя панель Other Settings в меню iOS Player Settings.


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