Event.capsLock 键盘capsLock大写锁定键

var capsLock : bool

Description描述

Is Caps Lock on? (Read Only)

Caps Lock键打开了么(只读)?

Returns true if Caps Lock is switched on.

如果Caps Lock大写键已开启,返回真。

using UnityEngine;
using System.Collections;

public class example : MonoBehaviour {
	void OnGUI() {
		Event e = Event.current;
		if (e.capsLock)
			GUI.Label(new Rect(10, 10, 100, 20), "CapsLock on.");
		else
			GUI.Label(new Rect(10, 10, 100, 20), "CapsLock off.");
	}
}
// Creates a Label and prints CapsLock on/off
// depending on the state of the capslock key.
//创建一个标签,打印CapsLock on/off
//取决于大写锁定键的状态。
function OnGUI() {
	var e : Event = Event.current;
	if (e.capsLock) {
		GUI.Label (Rect (10, 10, 100, 20), "CapsLock on.");
	} else {
		GUI.Label (Rect (10, 10, 100, 20), "CapsLock off.");
	}
}
Page last updated: 2010-12-31