Image Image Image Image Image Image Image Image Image Image
Scroll to top


Slow ScrollRect for Mobile Solution

Slow ScrollRect for Mobile Solution

Is your mobile ScrollRect sluggish? Do you need better ScrollRect performance on mobile?

tl;dr when you activate/instantiate your ScrollRect UI set your frame rate to 60 or above for a smooth scroll on mobile. Reset back to 30 (iOS default) when you deactivate/destroy your ScrollRectUI.

Application.targetFrameRate = 60;

Keep in mind your frame rate will impact battery performance so it’s important to manage your change or at least understand the negative impact of setting your frame rate much higher overall. When you run in Unity Editor your target frame rate will be higher than when you run on mobile, these default settings may cause your ScrollRect feel to be off. The code above should work in any script. The tricky part was realizing that the ScrollRect performance was not tied to the ScrollRect at all!

Link to Documentation

Note the following in the documentation:

The default value of Application.targetFrameRate is -1. In the default case, Unity uses the platform’s default target frame rate.

A mobile device’s maximum achievable frame rate is the refresh rate of the screen. For example, a device with a refresh rate of 60 Hertz has a maximum achievable frame rate of 60 frames per second. To target the maximum achievable frame rate, set Application.targetFrameRate to the screen’s refresh rate. Screen.currentResolution contains the screen’s refresh rate.

To conserve battery power, the default frame rate on mobile platforms is lower than the maximum achievable frame rate. Usually, the default frame rate on mobile platforms is 30 fps. To target the default frame rate, set Application.targetFrameRate to -1.

To target a frame rate other than the maximum achievable frame rate or the platform default on mobile platforms, set Application.targetFrameRate to the screen’s refresh rate divided by an integer. If the target frame rate is not a divisor of the screen refresh rate, the resulting frame rate is always lower than Application.targetFrameRate.

Note that mobile platforms ignore the QualitySettings.vSyncCount setting. Instead, you use the target frame rate to achieve the same effect as setting the vertical sync count. To do this, divide the screen’s refresh rate by the number of vertical syncs you want to allow between frames, and set Application.targetFrameRate to this number.

65 Views // June 18, 2022

Next Story

This is the most recent story.