90 / 120hz support

Can’t seem to find a lot of info on this, but do I need to do anything special to support 120 / 90 fps on Android other than disable vsync / vblanks (or skip that if on Unity 2021) and then

Application.targetFrameRate = Screen.currentResolution.refreshRate;

And hopefully “it just works”?

Or is there anything else I should be doing?

Unfortunately none of the Android devices we own, and the devices from our immediate social circles own over 60hz Android devices, so I can’t currently test if this works or not.

Is optimized frame pacing required for 90 / 120hz to work?

Is optimized frame pacing considered issue free in latest Unity 2020 LTS?

It’s not required. I recommend you reading up on what it is exactly, since it’s more about frame stability.
And I have seen no one with issues with it in 2020 and 2021 lts

We had some issues with it and I kept reading about more issues on the forums during the 2019LTS cycle. (for example: https://discussions.unity.com/t/803605/2 or https://forum.unity.com/threads/android-app-crashes-due-to-optimized-frame-pacing.1037809/ )

I was wondering if things have improved, specifically for 2020LTS.

Also only with frame pacing on does Unity request refresh rate changes (from the Android devices capable of doing so), so it doesn’t seem so far fetched that for it to work properly @ higher fps, frame pacing needs to be on. ( https://discussions.unity.com/t/814881/4 )

You say you have seen no issues, but do you have published games with it, or are you telling me the impression you have by reading the forums?

I haven’t seen issues myself, but I work on VR (oculus quest/quest 2) and a handful of higher end mobile devices, so no idea how older android versions fair.
Not too sure about the refresh rate, hadn’t read that post

1 Like

One aspect of what Google’s Swappy (which is currently used for “Optimized Frame Pacing”) does is try to adjust the display refresh rate to the best match for the current target frame rate. Otherwise it’s not mandatory. There are still some reports of problems with it that were reported in some forum threads but no other bug reports that I am aware of.

We made a change to the Adnroid vsync behavior in 2021.x. The vsync setting is now ignored and 30Hz is the default target frame rate. 30Hz works well with pretty much all displays.
With 90 or 120Hz it is very challenging to get stable frame rates for various reasons and in my opinion it’s a bad tradeoff for many mobile games.

1 Like

We’re thinking of defaulting to 60 and leaving the option for more than that in the options menu. 30 looks terrible and is really outdated IMO.

Our games have no issue hitting 120 on iOS devices, I don’t see why hitting 90 or 120 on high end Android devices would be a problem.

I see one potential pitfall here. If I use optimized frame pacing, set frame rate to 60 (and that’s on a device that can actually change refresh rates, so it changes to 60), if I then do

Application.targetFrameRate = Screen.currentResolution.refreshRate;

What will that return? The native max? Or 60?

Or should I just set a really high number (200?) and it will “just work”?

The Screen.resolutions[ ] array should list all supported refresh rates that Android reports in Display.getSupportedModes.
Screen.currentResolution.refreshRate should be the current refresh rate.

2 Likes

Learned today that we are not returning all refresh rates in the array but it’s getting addressed.

Hmm, in the meantime would setting framerate to a really high number (say 200), result in swappy setting refreshrate to the highest available? (144, 120, 90, whatever depending on the device).

I think it should work but not 100% sure…

1 Like