Documentation

Unity Engine


User Manual

Script Reference

Unity Engine


KeyDown

A keyboard key was pressed.
Read time 1 minuteLast updated 6 days ago

Definition

  • Type: Field
  • Namespace: UnityEngine
  • Assembly: UnityEngine.UICommonModule
KeyDown = 4

Remarks

Use _character to find out what has been typed. Use _keyCode to handle arrow, home/end or other function keys, or to find out which physical key has been pressed. This event is sent repeatedly depending on the end user's keyboard repeat settings.
Note that key presses can come as separate events, one with valid _keyCode, and another with valid _character. In case of keyboard layouts with dead keys, multiple _keyCode events can generate a single _character event.