Version: 2018.4
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 setting.

A good development practice on iOS is to never rely on exception handling (either internally or through the use of try/catch blocks). When using the default Slow and Safe option, Unity catches any exceptions that occur on the device and provides a stack trace. When using the Fast but no Exceptions option, any exceptions that occur will crash the game, and no stack trace will be provided. In addition, Unity raises the AppDomain.UnhandledException event to allow project-specific code access to the exception information.

With the Mono scripting backend, the game runs faster since the processor is not diverting power to handle exceptions. There is no performance benefit with the Fast but no Exceptions option when using the IL2CPP scripting backend. However, when releasing your game to the world, it’s best to publish with the Fast but no Exceptions option.

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 samples the accelerometer 60 times per second. You may see some performance benefit by reducing the accelerometer sampling frequency and you can even set it to zero for games that don’t use accelerometer input. You can change the Accelerometer Frequency setting under the Other Settings panel of the Player settings for the iOS platform.

Incremental builds

The C++ code generated by the IL2CPP scripting backend can be updated incrementally, allowing incremental C++ build systems to compile only the changes source files. This can significantly lower iteration times with the IL2CPP scripting backend.

To use incremental builds, choose the Append option after selecting Build from the Build Settings dialog. The Replace option performs a clean build.

Setting the frame rate

Unity iOS te permite cambiar la frecuencia con la que tu aplicación intentará ejecutar su ciclo de rendering, el cual está colocado por defecto a 30 frames por segundo. Puedes dejar más bajo este número para ahorrar batería, pero por supuesto este ahorro se hace al precio de tener menos actualizaciones de frames. De forma opuesta, puedes incrementar la velocidad de frames para dar prioridad al rendering sobre otras actividades tales como entradas de la pantalla táctil o procesamiento del acelerómetro. Necesitarás experimentar con tu escogencia de velocidad de frames para determinar en qué forma afecta la jugabilidad en el caso de tu juego.

Si tu aplicación involucra cálculos o rendering pesados y puedes mantener sólo 15 frames por segundo, por decir algo, entonces al configurar la velocidad deseada con un valor más alto que quince no ofrecería ningún desempeño adicional. La aplicación tiene que estar optimizada lo suficiente para permitir una velocidad de frames más alta.

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


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