Event.numeric 数字键盘

var numeric : bool

Description描述

Is the current keypress on the numeric keyboard? (Read Only)

当前是在数字键盘的按键么(只读)?

use this flag to destinguish between main & numeric keys.

使用这个标识主键和数字键。

using UnityEngine;
using System.Collections;

public class example : MonoBehaviour {
	void OnGUI() {
		Event e = Event.current;
		if (e.numeric)
			GUI.Label(new Rect(10, 10, 150, 20), "Numeric Key pad is on");
		else
			GUI.Label(new Rect(10, 10, 150, 20), "Numeric Key pad is off");
	}
}
// Creates a Label and prints Numeric Key pad is on/off
// depending on the state of the numlock key.
//创建一个标签,并打印数字键盘的on/off
//取决于numlock键的状态。
function OnGUI() {
var e : Event = Event.current;
	if (e.numeric) {
		GUI.Label (Rect (10, 10, 150, 20), "Numeric Key pad is on");
	} else {
		GUI.Label (Rect (10, 10, 150, 20), "Numeric Key pad is off");
	}
}
最后修改:2010年12月31日 Friday 22:04

本脚本参考基于Unity 3.4.1f5

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