EditorWindow.mouseOverWindow 鼠标在窗口之上

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.

EditorWindow.mouseOverWindow 鼠标在窗口之上

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();
	}
}
最后修改:2011年6月24日 Friday 15:43

本脚本参考基于Unity 3.4.1f5

英文部分版权属©Unity公司所有,中文部分© Unity圣典 版权所有,未经许可,严禁转载 。