public static EditorWindow focusedWindow ;

Description

当前已获得键盘焦点的 EditorWindow。(只读)

如果没有窗口获得焦点,则 focusedWindow 可以为 null。

另请参阅:mouseOverWindowFocus


Focus other windows with a mouse click.

using UnityEngine;
using UnityEditor;

// Prints the name of the focused window to a label

public class FocusedWindow : EditorWindow { [MenuItem("Examples/FocusedWindow")] public static void Init() { GetWindow<FocusedWindow>("FocusedWindow"); }

void OnGUI() { GUILayout.Label(EditorWindow.focusedWindow.ToString()); } }