Game locked to 30FPS despite setting target frame rate to 60

I am working on a 2D platformer which used Universal Render Pipeline, however due to some instability issues regarding that pipeline, I switched back to Unity’s default renderer and my game’s FPS was solid 60 without a single drop when I first tested it on my device.

After I made some minor adjustments to the scene (set textures’ shader to Diffuse and added a light to the scene to make it “darker”), I built the game and ran it on Android, only to be greeted with a locked 30FPS, even though I set Application.targetFrameRate = 60; in my Start() method.

This is what the profiler shows, first screenshot is without the vSync profiled module, second one is with:

Now I ain’t a professional when it comes to using the profiler, but I feel like my issue is caused by vSync somehow being turned on and the game being locked to 30FPS or something, which is weird, because I disabled vSync both in the Quality settings, and through the script (vSyncCount = 0;), and yet my game is still locked to 30FPS.

I am fairly certain my device’s refresh rate is not 30Hz, and to further make sure I even enabled refresh rate display in developer settings and it does display 60Hz.

Did I maybe miss some setting, or something? Is my issue even caused by vSync?

Check your player settings if “Optimized Frame Pacing” is enabled. Disabling it might fix your problem.

2 Likes

Do you have an absolute list of exactly what needs to be set to what, to get 60fps on Android?

And 120fps on Android?

Getting this right has always been a game of matrix testings of settings, and it’s never quite certain why it’s not the same between versions.

I disabled it now, but no change, game is still locked to 30FPS.

What I did notice though is, for the first frame or two, the FPS counter actually shows 60FPS, but then the game just locks to 30 and doesn’t go above that.

Hi

Did you managed to make your game run with 60 FPS?

Im Having the same issue. Even just a cube with no movement gets 30 FPS. Im using Unity 2021 with URP for Android.

1 Like

Hi

I’ve just got into this same issue, but maybe mine is different reason.

I’m working on my game and it’s always 60 on the editor and became locked to 30 the next day I worked. After a lot of searching I tried something out. Basically I’m working on a gaming laptop and so I plugged in the charger, and now it’s back to 60. So the conclusion for my problem is I’ll be locked to 30 if on battery, and be unlocked if I go with plugged.

Probably could go unlocked to on battery if I set my Windows battery settings to Better Performance, but it’s alright I like my battery life more. Wish that there’s just some info about this though, so it’s not a waste of time searching for answers thinking you have something wrong in your game.

2 Likes

Check your player settings if “Optimized Frame Pacing” is enabled. Disabling it might fix your problem.
Thanks! That has actually helped me and solved my problem!

Edit >> Project settings >> Adaptive Performance >>

Uncheck Adaptive performance on startup
Uncheck providers

U r welcome :slight_smile:

15 Likes

Thanks. This worked for me.

Even though I didn’t have the Adaptive Performance Package installed in my project, it was still locking at 30 FPS. It asked me to install the package which I did and then followed your steps.

And it worked. :slight_smile:

8 Likes

I was going insane but this worked for me. Thanks!

1 Like

The “Adaptive Performance Package” solution was the way to go for me. Thanks!

There’s a small caveat: every time I build, a warning popup appears saying that I haven’t set a provider. Any idea if it’s possible to disable that popup?

1 Like

I ended up installing a provider and then disabling it. :shrug:

void Update()
{
Application.targetFrameRate = 60;
}
only in this case woked for me when Application.targetFrameRate= 60 was in update method.

2 Likes

thanks. that’s the only thing that worked for me too!

You can try adding it in the Start() method instead of the Update() to only set it once when the game starts and avoid updating it every frames for the entire game

it’s a weird problem!

Thanks everyone for contributing and finding solutions!

2 Likes

I found that the target framerate was being reset to 30 when the scene was changed, so subscribing to this event solved it for me:

void OnSceneLoaded(Scene scene, LoadSceneMode mode)
{
Application.targetFrameRate = 60;
}```

For my issue, I called Application.targetFrameRate = 60 in Awake() instead Start(). Put this to Start() and it should work

1 Like

I’m using Unity 6000.0.3f1 Preview

Bro, what even this? (Not asking, just reaction to how wild this is) Unity has to do something with this, like Godot for example. There is a vsync option, so if it is on, they always target the default frame rate of the current device when playing the game. And you can change the fps later via some API. The only way I can make this work is to set targetFrameRate = 90 (my default framerate of the phone I’m using) and then I can make a setting for changing the frame rate to 30-60-90-120.
Funny how if I change my phone frame rate to 60 then even the targetFrameRate = 90 at the beginning. It will change it to 60. Funny how.

Okay, the Optimized Frame Pacing must be disabled
Because if that enable then when I run this at the start

Screen.currentResolution.refreshRateRatio.value;

It always returns 30.

But if I disabled Optimized Frame Pacing
and then at the start of the game. I just

Application.targetFrameRate = (int)Screen.currentResolution.refreshRateRatio.value;

Then the game will run at the screen refresh rate rather than 30.
And you can make an options setting to change the frame rate like other games.

Now My Own Solution not works with unity 6 URP🥲

works thanks a lot
:blush:

Some info to consider:

Generally on Android, the default Framerate is 30 (to save battery). Frame Pacing is disabled by default and Adaptive Performance is not installed (so installing it and disabling it is not a valid solution for the initial problem - it still might work for other reasons but you should not have to do that to get to your targetframerate).

BTW, if you are using Adaptive Performance (and we had some bugs in 5.1 make sure to update to 5.1.1) we recommend to not enable Optimize Framepacing and use no vsync.

Generally if you use vsync it will change/sync to the display refresh rate (without anything else turned on). This (can) and will be changed by the OEM. Sometimes, you can try this by changing your bundle ID and see if your app is locked to a certain framerate by the OEM.

Framepacing will change it, and that’s on purpose to improve performance. Using a specified target framerate will not be the best way to control the system on a frame by frame base, you basically hand it over to the OS.

2 Likes