- Home /
Application.targetFrameRate doesn't work in the Editor?
I seem to get wildly fluctuating frame-rates in the editor (200-500) and this results in very jerky motion. This happens even when I set Application.targetFrameRate to 60 and QualitySettings.vSyncCount to 1.
If I make an actual windows build, these settings take and everything is nice and smooth. So, is there a way to make targetFrameRate work in the editor?
Right now iterating on controls and motion in the editor is extremely frustrating.
If you're getting jerky motion, maybe you're putting your movement code in Update() ins$$anonymous$$d of FixedUpdate()?
You're supposed to put movement in Update. FixedUpdate is only for physics, and will result in jerky movement if you put code in there (unless the physics framerate exceeds the screen framerate).
Eric's answer should explain Application.targetFrameRate. As for QualitySettings.vSyncCount, beware that Unity, as a client application, cannot overrule driver settings. VSync can be controlled externally in your driver control software. Check the setting there, too. If you have an NVidia card, its name is "NVidia Control Panel". I think it's called "Catalyst Control Center" for ATI cards. It should ideally be set to use Application Settings, so that client apps like Unity get to define their own.
Answer by Eric5h5 · Feb 04, 2014 at 07:20 AM
As the docs say, targetFrameRate is ignored in the editor. You can use vsync (which should work—it does here). If you're looking at the stats window, that's how long it takes to draw the graphics, which isn't necessarily the actual fps. You can use an fps counter script to see the real fps if necessary.
Yeah, I made an FPS counter script using System.Diagnostics.Stopwatch to check how many times Update gets called in a frame. I'm getting wildly varying frame-rates even with v-sync enabled.
Although you can, don't use Stopwatch for this. That's kind of the "long way around". The framerate is just 1 / Time.deltaTime. I use this, which can be added to any script (provided it does not already define OnGUI):
#if UNITY_EDITOR
// Writes the rendertime and actual FPS for debug purposes in the editor
private void OnGUI()
{
GUI.Label(new Rect(0, 50, 200, 50), new GUIContent("Time taken to render previous frame: " + Time.deltaTime));
GUI.Label(new Rect(0, 100, 200, 50), new GUIContent("Frames per second: " + 1 / Time.deltaTime));
}
#endif
There's a bit of platform dependent compilation there, to prevent the text from showing up in builds. It will display only in the editor.
Use this: http://wiki.unity3d.com/index.php?title=FramesPerSecond That way you have a readout of the average fps over the previous half-second, so it doesn't vary every frame.
Your answer
![](https://koobas.hobune.stream/wayback/20220613132510im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
Unity editor low frame rates and flashing while pressing keys 1 Answer
Updated to 2021.3.3, why did my FPS drop significantly? (over 350fps) 0 Answers
Why is my build running so slow despite running fine in editor? 2 Answers
HDRP Reflection probes cause terrible framerate 2 Answers
Limit FPS in the editor? 1 Answer