From 0d082f5773d4d5f7f67e06bbe001dc0c253bc4d9 Mon Sep 17 00:00:00 2001 From: Chandler Cox Date: Sat, 1 Apr 2023 17:23:00 -0500 Subject: [PATCH] Added ability to change the fps of the not focused editor window. --- Source/Editor/Options/GeneralOptions.cs | 7 +++++++ Source/Editor/States/EditorState.cs | 7 ++++--- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/Source/Editor/Options/GeneralOptions.cs b/Source/Editor/Options/GeneralOptions.cs index e97278aa0..63822a7ca 100644 --- a/Source/Editor/Options/GeneralOptions.cs +++ b/Source/Editor/Options/GeneralOptions.cs @@ -106,6 +106,13 @@ namespace FlaxEditor.Options [DefaultValue(60.0f), Limit(0, 666)] [EditorDisplay("General", "Editor FPS"), EditorOrder(110), Tooltip("Limit for the editor draw/update frames per second rate (FPS). Use higher values if you need more responsive interface or lower values to use less device power. Value 0 disables any limits.")] public float EditorFPS { get; set; } = 60.0f; + + /// + /// Gets or sets The FPS of the editor when the editor window is not focused. Usually set to lower then the editor FPS. + /// + [DefaultValue(15.0f), Limit(0, 666)] + [EditorDisplay("General", "Editor FPS When Not Focused"), EditorOrder(111), Tooltip("The FPS of the editor when the editor window is not focused. Usually set to lower then the editor FPS.")] + public float EditorFPSWhenNotFocused { get; set; } = 15.0f; /// /// Gets or sets the sequence of actions to perform when using Build Scenes button. Can be used to configure this as button (eg. compile code or just update navmesh). diff --git a/Source/Editor/States/EditorState.cs b/Source/Editor/States/EditorState.cs index b900e3cca..ac644f5e1 100644 --- a/Source/Editor/States/EditorState.cs +++ b/Source/Editor/States/EditorState.cs @@ -93,12 +93,13 @@ namespace FlaxEditor.States /// public virtual void UpdateFPS() { - var editorFps = Editor.Options.Options.General.EditorFPS; + var generalOptions = Editor.Options.Options.General; + var editorFps = generalOptions.EditorFPS; if (!Platform.HasFocus) { // Drop performance if app has no focus - Time.DrawFPS = 15; - Time.UpdateFPS = 15; + Time.DrawFPS = generalOptions.EditorFPSWhenNotFocused; + Time.UpdateFPS = generalOptions.EditorFPSWhenNotFocused; } else if (editorFps < 1) {