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);
}
最后修改:2011年1月4日 Tuesday 0:34

本脚本参考基于Unity 3.4.1f5

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