diff --git a/Source/Editor/Viewport/EditorViewport.cs b/Source/Editor/Viewport/EditorViewport.cs index 1e24560d8..f90e345e6 100644 --- a/Source/Editor/Viewport/EditorViewport.cs +++ b/Source/Editor/Viewport/EditorViewport.cs @@ -1241,6 +1241,10 @@ namespace FlaxEditor.Viewport private class FpsCounter : Control { + private int fps; + private int accumFrames; + private float lastUpdate; + public FpsCounter(float x, float y) : base(x, y, 64, 32) { @@ -1250,7 +1254,15 @@ namespace FlaxEditor.Viewport { base.Draw(); - int fps = Engine.FramesPerSecond; + accumFrames++; + float timeNow = Time.TimeSinceStartup; + if (timeNow - lastUpdate >= 1.0f) + { + fps = accumFrames; + lastUpdate = timeNow; + accumFrames = 0; + } + Color color = Color.Green; if (fps < 13) color = Color.Red;