Version: 2017.3
Optimizing Performance in iOS.
Measuring Performance with the Built-in Profiler

iOS Specific Optimizations

This page details optimizations which 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 to 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.

Setting the Desired Framerate

Unity iOS 允许您更改应用程序尝试执行其渲染循环的频率;默认情况下,此频率设置为 30 帧/秒。降低此数字可以节省电池电量,但当然这种节省将以减少帧更新为代价。相反,也可以增加帧率,使渲染优先于其他活动(如触摸输入和加速度计处理)。您需要尝试选择不同的帧率来确定帧率在具体情况下对游戏运行过程的影响。

例如,如果应用程序涉及繁重的计算或渲染,但只能维持 15 帧/秒的帧率,那么将所需的帧率设置为高于 15 将不会带来任何额外的性能。必须充分优化应用程序来支持更高的帧率。

To set the desired framerate, change Application.targetFrameRate.

Tuning Accelerometer Processing Frequency

If accelerometer input is processed too frequently then the overall performance of your game may suffer as a result. By default, a Unity iOS application will sample the accelerometer 60 times per second. You may see some performance benefit by reducing the accelerometer sampling frequency and it can even be set to zero for games that don’t use accelerometer input. You can change the accelerometer frequency from the Other Settings panel in the iOS Player Settings.

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