\$\begingroup\$

I have an Unity app that requires a stable fps in editor. The fps itself is really high anywhere from 200 to 280 the problem is that is not consistent. I tried to limit it with the code belove but it still goes up and down too much. So it is not a problem of how high it is but how stable it is. I did not test it in the build because I don’t need to build this application I need it to work in editor.

    using UnityEngine;

[ExecuteInEditMode]
public class FrameRateLimiter : MonoBehaviour
{
    [SerializeField] private int _target = 240;

    private void Start()
    {
        QualitySettings.vSyncCount = 0;
    }

    private void Update()
    {
        if (Application.targetFrameRate != _target)
            Application.targetFrameRate = _target;
    }
}

\$\endgroup\$

You must log in to answer this question.