All videos · All how-to videos

How to react to Key Down and Key Up in R3

0:48 · 2026-10-29

In the R3 editor: add two Code components, set the first one's Event to Key Down and the second one's to Key Up, and give each one line: Space down makes the cube tall, Space up puts it back. Start Code, click the scene and hold Space. Hold it again and click outside the scene: the key still gets its Key Up. Narration: AI voice.

Watch on YouTube

Chapters

  1. 0:00 Create: add two Code components
  2. 0:08 Set the first one's Event to Key Down
  3. 0:16 Space down makes the cube tall
  4. 0:24 Set the second one to Key Up
  5. 0:28 Its code puts the cube back
  6. 0:33 Start Code and click the scene
  7. 0:36 Hold Space, let go
  8. 0:40 Click outside: the key still gets its Key Up

Transcript

0:02 Open the menu, then Create, and add two Code components.

0:08 In the Inspector, open the first one, and set its Event to Key Down.

0:16 Press Edit Code. When Space goes down, make the cube tall.

0:21 Save, and close the editor.

0:24 Open the second one, and set it to Key Up.

0:28 In its code, put the cube back. Save, and close.

0:33 Start Code at the top, and click the scene.

0:36 Hold Space. Key Down. Let go. Key Up.

0:40 Hold it again, and click outside the scene. The key still gets its Key Up.