static var mouseOverWindow : EditorWindow
Description描述
The EditorWindow currently under the mouse cursor (Read Only)
鼠标指针在当前的编辑器窗口之上(只读)。
/mouseOverWindow/ can be null if there is no window under the cursor.
如果窗口之上没有光标,mouseOverWindow可以为null。
参见:focusedWindow.
Move the mouse over other Unity windows to automatically focus them.
移动鼠标到另一个Unity窗口之上来自动焦点它们。
// Focus any unity window where the mouse is over.
//鼠标移到到上面,焦点另一个unity窗口
class mouseFocusedWindowEx extends EditorWindow {
var mouseOver : String = "Nothing...";
@MenuItem("Example/Quick Window Selector _s")
static function Init() {
var window = GetWindowWithRect(mouseFocusedWindowEx,Rect(0,0,200,50));
window.Show();
}
function OnGUI() {
GUILayout.Label("Mouse over " + mouseOver);
if(GUILayout.Button("Close")) {
this.Close();
}
mouseOver = EditorWindow.mouseOverWindow ?
EditorWindow.mouseOverWindow.ToString() : "Nothing...";
}
function OnInspectorUpdate() {
if(EditorWindow.mouseOverWindow) EditorWindow.mouseOverWindow.Focus();
this.Repaint();
}
}