RUSTICDOCSSearch documentation

Input API

Read held keys forwarded from the editor's embedded Play viewport.

When to call it

For movement, read rustic.key(name).held in FixedUpdate. Hover or click the Play viewport first. This build forwards WASD, arrow keys, and Shift only. Named actions and press/release events are not connected yet.

Calls

  • rustic.input(action)
  • rustic.key(key)
  • rustic.key_events()
  • rustic.any_key_pressed()

Variables

VariableTypeRequiredDescription
actionstringYesConfigured action name; currently returns an inactive state.
keystringYesKeyW, KeyA, KeyS, KeyD, an Arrow direction, ShiftLeft, or ShiftRight.

Return and timing

Key reads return { pressed, released, held, axis }. Only held and axis are populated for forwarded keys; pressed/released stay false, key events stay empty, and any-key stays false.

Language examples

Lua 5.4

lua
if rustic.key('KeyW').held then
  print('forward key is held')
end

JavaScript

javascript
if (rustic.key('KeyW').held) console.debug('forward key is held');

Python

python
held = rustic.key("KeyW")["held"]

C++

cpp
RusticActionState forward=rustic.key("KeyW");
if (forward.held) rustic.log("debug", "moving");

C#

csharp
bool held = rustic.key("KeyW").held;

Luau

lua
if rustic.key('KeyW').held then rustic.log('info','moving') end

C

c
bool held = rustic.key("KeyW").held;

Java

java
boolean held = rustic.key("KeyW").held;

PHP

php
$held = $rustic->key("KeyW")["held"];

HTML / inline JS

javascript
if (rustic.key('KeyW').held) console.debug('forward key is held');

Constraints and behavior

  • The embedded Play viewport forwards held KeyW, KeyA, KeyS, KeyD, ArrowUp, ArrowDown, ArrowLeft, ArrowRight, ShiftLeft, and ShiftRight. It does not forward other keys or input from New Window or Standalone. Follow the Lua controller guide for attachment steps, a complete example, and troubleshooting.
  • Every gameplay language calls the engine-owned API. Rustic supplies SDKs and dispatches callbacks; scripts do not parse requests or serialize responses. See the language guide for complete setup and callback registration.