Behaviour of Screen.currentResolution.refreshRateRatio

Are the values in Screen.currentResolution.refreshRateRatio supposed to reflect changes made to
Application.targetFrameRate?

I have a Google Pixel 6a that I recently updated to Android 14. When I set the targetFrameRate, I get the following for the refreshRateRatio (rrr)

The in game frame rate does change correctly, but these reported numbers seem wrong. I would swear the denominator used to change under Android 13 - but I might be dreaming…
Are the above results expected?

Jules

bump… does anyone know how targetFrameRate and refreshRateRatio are supposed to interact?

On a side note - I used to look forward to coming to these forums. The many diligent Unity and community folks who answered were extremely well informed and saved me a lot of development time. Recently - most of my questions go unanswered. Its rare I get a response from a unity rep. Makes me a bit sad.

I think that’s only true if setting the frame rate actually causes the Android device to change the screens refresh rate, which some do when you have optimized frame pacing on.

ok. thanks @AcidArrow . It makes a difference to how I determine which framerates to use for normal play, and for low-end or low battery devices. Doesn’t look like I can rely on the refreshRateRatio to tell me the current unity attempted rendering frame rate at all. I’m not sure what I can really use it for - other than determining the frame rate when the app started.

There’s no currently attempted framerate, it’s what you set it to. It’s 30 by default on mobile I think, but you should be setting it yourself.

Have an option like FPS Limit: 30 - 60 - Off. You should typically default to 60 and have it change to 30 if you think it’s a low powered device (how you determine that is tricky, maybe check device ram or something).

For “off” (which should be the maximum hz the device can do), do something like:

Resolution[] allResolutions = Screen.resolutions;
int maxRefresh = 30;
for (int i = 0; i < allResolutions.Length; i++) {
    maxRefresh = max(maxRefresh, allResolutions[i].refreshRate);
}
maxRefresh = clamp(maxRefresh, 30, 300);
Application.targetFrameRate = maxRefresh;

This seems to be broken on Android 14; we have run into the same problem and on Android 13 devices Screen.currentResolution.refreshRateRatio returns the correct refresh rate.

Can you elaborate? What seems broken?

I think the problem is that on Android 14 after you set the targetFrameRate, the refreshRateRatio.value does not change to match. Same question as in my OP.

I have a suspicion that the behaviour has changed between Android 13 and Android 14 - but I havent validated this.

@AcidArrow - I think you’re correct to mention OptimizedFramePacing above. This does seems to change the behaviour.