Event.keyCode 键码
var keyCode : KeyCode
Description描述
The raw key code for keyboard events.
键盘事件的原始键码。
Used in EventType.KeyDown and EventType.KeyUp events; this returns KeyCode value that matches the physical keyboard key. Use this for handling cursor keys, function keys etc.
在EventType.KeyDown和EventType.KeyUp事件中使用,返回机器物理键盘键的键码值。使用这个处理光标键,功能键等。
参见: Event.character.
using UnityEngine;
using System.Collections;
public class example : MonoBehaviour {
void OnGUI() {
Event e = Event.current;
if (e.isKey)
Debug.Log("Detected key code: " + e.keyCode);
}
}
// Detects keys pressed and prints their keycode
//检测按下的键,并打印它们的键码
function OnGUI() {
var e : Event = Event.current;
if (e.isKey) {
Debug.Log("Detected key code: " + e.keyCode);
}
}
最后修改:2010年12月31日 Friday 22:25