Keyboard Event

The Keyboard Event behavior listens for input from an external hardware keyboard and triggers other behaviors when a specified event occurs. This can be used to create keyboard controls for your game.

⚠️ Warning: This feature is only supported on iOS 13.0 and above.


Property Description

Select an event to listen to.

  • On Press - Trigger behaviors when a key has been pressed.
  • While Pressed - Trigger behaviors while a key is pressed.
  • On Release - Trigger behaviors when a key has been released.
  • On Sequence - Trigger behaviors when a sequence of keys have been pressed.

Select any of the special keys on the keyboard to listen to: Up ArrowLeft ArrowRight Arrow, Down ArrowSpacebarShiftDeleteControlOptionCaps LockTab and Escape.

Or you can select Character and enter a single character on the keyboard to listen for like a or d.

Or you can select Any and listen to all keys on the keyboard.

Character Sequence Enter a sequence of characters (string) that must be pressed on the keyboard to trigger the behavior.


Output Field Description

The string representation of the key that was pressed. This will always be a single character, but for special keys like arrows, this will be blank.

("x", "a", "5", etc.)


The numeric representation of the key that was pressed. Every key has a numeric value tied to it according to ASCII.

(78, 61, 35, etc.)


(On Sequence)

The character sequence.


(On Sequence)

The length of the character sequence.


Example: Keyboard Controlled Player
The player moves left while the left arrow is held and the player moves right while the right arrow is held. When the user presses the up arrow, the player jumps.


Example: An Easter Egg
When the user enters "party" on their keyboard, the screen shakes, confetti particles emit from the player and a celebratory sound effect is played.



Article is closed for comments.