Version: 2019.2
public static bool isFocused ;

Description

Whether the player currently has focus. Read-only.

In the editor, this corresponds to whether the game view has focus (regardless of whether the editor is in play mode or not).

See Also: MonoBehaviour.OnApplicationFocus.