Something in the last couple of days has changed in my project that is resulting in lower FPS. One possibility was the upgrade to Unity 2020.2.
I’m developing on a Mac and in the when running from the editor, I was getting anywhere from 500 to 2000 FPS. Now I’m getting between 60 and 120. Even if I turn off all my objects(uncheck in the Inspector), I still get this low range.
I’m fairly new to Unity and it’s possible I’ve inadvertantly flipped some setting somewhere that is causing this. Or maybe it is something about the 2020.2 upgrade.
Take a look at the Profiler. In newer versions of Unity the Profiler now gives VSync its own separate CPU Usage category, so it is pretty easy to spot VSync as the culprit. Previously you’d infer it by looking deeper into the data. Whenever you see FPS locked to a value roughly the same as a monitor refresh rate, VSync is probably a safe assumption, or at least a good first thing to check.
Here’s some good reading on using the Profiler for looking into these kinds of issues:
Tried setting the VSync setting to 0 in code as well as in the Quality project settings (VSync Count = Don’t Sync). This didn’t make any difference.
It is curious that the FPS seems to hover around 60 (or occasionally in the 120 range).
I’m aware that bumping the FPS higher than 120 probably will no have any useful effect, but I’m not done adding elements to the simulation and I want to make sure I haven’t inadvertently set something incorrectly.
I haven’t tried profiling yet, but do notice that in the Stats window of the editor it shows:
But did you confirm in the Profiler it actually is VSync causing the performance drop? If it isn’t, then the Profiler will show what else the CPU is spending all its time on.
The stats view is not an accurate or detailed profiling tool, especially before 2020.2 (and just in general because you are looking at Editor Playmode data). Pre 2020.2 it reported timings differently so that might explain why it looks like performance regressed while nothing in terms of performance actually changed. If you want to compare performance of the 2 versions, use the profiler, ideally in Standalone mode, and use the Profile Analyzer (a package) to compare the profile captures.
Also, check if your resolution drop-down in the game view has vSync checked on, that would override anything else.
I tried profiling, but this is the first time I’ve used it and it’s not clear I’m interpreting it correctly. It seems that all the time is spent in rendering. However, I’ve built a version that has all my GameObjects disabled (unchecked) so the screen is blank and it still shows all the time in rendering.
On non-mobile platforms, targetFrameRate = -1 should give you the highest possible frame rate. Not too sure what 1000 would do of that can’t be achieved. Be sure to check out the Scripting docs page on Application.targtFrameRate because its usage isn’t quite that straightforward. I’m unaware of any hard limitation to the monitor refresh rate or in this case 60 FPS on OSX/Metal (mobile has those) but it looks like hat might be happening here?
That graph is also way to broad in its categorization to allow a flat categorization. The details Panel below the charts is there to disambiguate these numbers.
Check out this Unite Now 2020 video: Introduction to Profiling. We’re also doing our best to make the Profiler documentation as informative and helpful in getting started and understanding how to use and read the Profiler.
This:
And for builds, I’ve seen users on Windows run into issues with tuning, overclocking or graphics driver software enforcing VSync on their editor and games. Not sure if something similar could happen on Mac as I’m not that much of a Mac user. After excluding everything else, this might be something to bring up in the Mac specific sub-forums.
I’ve the same exact problem, suddenly its locked to 30FPS while targeting android platform.
I’ve disabled Vsyc, run an empty scene with URP , 30FPS locked, setting targetFrameRate in code didnt change anything.
Higher framerate actually reflect for me how to expect performance in mobile
Example at old way:
Editor: game run on 1000FPS, then I may expect it run 50-60FPS on my phone
Editor: run on 30FPS , I cant even imagine it would run on mobile
Now when editor run by default at 30 or 60FPS whiling setting target platform to mobile, now I feel like I must make a build to see how that effect the overall performance.
I hope you you adjust that and make it like before.
EDIT:
Also I notice an awkward issue, when game view while the scene view is active, it run on 30FPS, if I switched the scene view with profilier view, suddenly the game view jump to 60FPS
interesting. I’m not aware of any default frame rate locking and can’t reproduce it on my machine so far.
What Graphics API are you targeting? (Player Settings)
Do you have any gaming overlays, graphics driver, overclocking or similar enforcing vSync? Maybe GSync? do you have multiple monitors attached and does detaching them change anything? (e.g. I get capped to 60fps when connecting my TV)
@OmarVector do you have a multi monitor setup? what refresh rate do our monitors run at? And what happens if you disconnect some or all but one monitor?
I do have a two monitor setup. Disconnecting the second monitor does make a significant difference.
Running from the Editor with “Maximize on Play”:
2 monitors : ~60 FPS
1 monitor : ~ 102 FPS
Running a stand alone build on Mac:
2 monitors : ~110 FPS
1 monitor : ~ 150 FPS
I’m happy with the performance with 1 monitor. If a customer has two, will they see the same performance drop?
It is still a mystery as to why a build for iOS gets 30 FPS almost exactly. It really seems that something is clamping the frame rate there. As I’ve previously explained, I believe I have everything set to allow it to run as fast as possible.
I’m not entirely sure but I’d suspect your two monitors to have different refresh rates which is probably hampering your graphics card’s / driver’s or our graphics API implementation to output images at the highest possible rate?