GUIUtility.hotControl 热点控件

static var hotControl : int

Description描述

The controlID of the current hot control.

当前热点控件的controlID。

The hot control is one that is temporarily active. When the user mousedown's on a button, it becomes hot. No other controls are allowed to respond to mouse events while some other control is hot. once the user mouseup's, the control sets hotControl to 0 in order to indicate that other controls can now respond to user input.

热点控件是一个临时激活的控件。当用户在按钮上鼠标按下,它变为热点。在某些控件时热点时,不允许其他控件响应鼠标事件。一旦用户鼠标弹起,控件设置hotControl为0,为了表明其他控件能响应用户输入。

using UnityEngine;
using System.Collections;

public class example : MonoBehaviour {
	void OnGUI() {
		GUILayout.Button("Press Me!");
		Debug.Log("id: " + GUIUtility.hotControl);
	}
}
// Click on the button to see the id
//点击按钮查看id
function OnGUI() {
	GUILayout.Button("Press Me!");
	Debug.Log("id: " + GUIUtility.hotControl);
}
Page last updated: 2011-1-4