GUIUtility.keyboardControl 键盘控件

static var keyboardControl : int

Description描述

The controlID of the control that has keyboard focus.

具有键盘焦点控件的controlID。

using UnityEngine;
using System.Collections;

public class example : MonoBehaviour {
	private string str = "A String!";
	void OnGUI() {
		str = GUILayout.TextField(str, 10);
		Debug.Log("id: " + GUIUtility.keyboardControl);
	}
}
// Click on the text field to see the id of the control.
//点击文本字段查看控件的id
private var str : String = "A String!";
function OnGUI() {
	str = GUILayout.TextField(str,10);
	Debug.Log("id: " + GUIUtility.keyboardControl);
}
最后修改:2011年1月4日 Tuesday 0:39

本脚本参考基于Unity 3.4.1f5

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