语言英语
  • C#

GUIUtility.hotControl

public static int hotControl;

描述

当前热控件的 controlID。

热控件是临时处于活动状态的控件。当用户在按钮上按下鼠标时,它会变为热控件。
当其他控件处于热状态时,不允许其他任何控件响应鼠标事件。
当用户松开鼠标时,控件会将hotControl设置为 0,以指示其他控件现在可以响应用户输入。

using UnityEngine;

public class Example : MonoBehaviour { // Click on the button to see the id

void OnGUI() { GUILayout.Button("Press Me!"); Debug.Log("id: " + GUIUtility.hotControl); } }

Did you find this page useful? Please give it a rating: