diff --git a/Source/Editor/Windows/GameWindow.cs b/Source/Editor/Windows/GameWindow.cs
index 2e9fa4014..fdedbb3c2 100644
--- a/Source/Editor/Windows/GameWindow.cs
+++ b/Source/Editor/Windows/GameWindow.cs
@@ -466,8 +466,13 @@ namespace FlaxEditor.Windows
///
public override void OnMouseLeave()
{
- Parent?.Focus();
base.OnMouseLeave();
+
+ // Remove focus from game window when mouse moves out and the cursor is hidden during game
+ if ((IsFocused || ContainsFocus) && Parent != null && Editor.IsPlayMode && !Screen.CursorVisible)
+ {
+ Parent.Focus();
+ }
}
///