Documentation

Unity Engine


User Manual

Script Reference

Unity Engine


CapsLock

Is Caps Lock on?
Read time 1 minuteLast updated 6 days ago

Definition

  • Type: Field
  • Namespace: UnityEngine
  • Assembly: UnityEngine.CoreModule
CapsLock = 32

Remarks

Additional Resources: Event.capsLock.

Examples

using UnityEngine;using UnityEngine.UIElements;[RequireComponent(typeof(UIDocument))]public class Example : MonoBehaviour{ // Prints CapsLock on/off depending on the state of the capslock key. void OnEnable() { var textField = new TextField(); textField.RegisterCallback<KeyDownEvent>(e => { if ((e.modifiers & EventModifiers.CapsLock) != 0) { Debug.Log("CapsLock on."); } else { Debug.Log("CapsLock off."); } }, TrickleDown.TrickleDown); GetComponent<UIDocument>().rootVisualElement.Add(textField); }}