本页面详细介绍 iOS 部署所特有的优化。
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).
Locate the Script Call Optimization setting in the _Other Settings section.
The options for this setting are:-
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.
Unity iOS 允许您更改应用程序尝试执行其渲染循环的频率;默认情况下,此频率设置为 30 帧/秒。降低此数字可以节省电池电量,但当然这种节省将以减少帧更新为代价。相反,也可以增加帧率,使渲染优先于其他活动(如触摸输入和加速度计处理)。您需要尝试选择不同的帧率来确定帧率在具体情况下对游戏运行过程的影响。
例如,如果应用程序涉及繁重的计算或渲染,但只能维持 15 帧/秒的帧率,那么将所需的帧率设置为高于 15 将不会带来任何额外的性能。必须充分优化应用程序来支持更高的帧率。
要设置所需的帧率,请更改 Application.targetFrameRate。
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.