Input
Read held keys, touchscreen contacts and object clicks in Play.
Feature status and language/platform compatibility
Choose an API to see its signature, parameters, examples and behavior.
APIs
Module guide
When to call it
Read rustic.key(name).held in FixedUpdate for movement. Query keyboard edges, mouse clicks and wheel deltas in Update. Use Input touch and object click subscriptions in Start.
Variables
| Variable | Type | Required | Description |
|---|---|---|---|
action | string | Yes | Configured action name; currently returns an inactive state. |
key | string | Yes | A physical key name such as KeyW, Space, or ArrowUp. |
button | string | Yes | One of left, right, middle, back, or forward. |
Return and timing
Key reads return { pressed, released, held, axis }. Packaged desktop games also report press and release edges and ordered key events. Input.mouseButton() returns {pressed, released, held, clicked}. Input.mouseWheel() returns signed {x, y} scroll deltas in line units. Positive x means right and positive y means up. Input.touches() and Input.touchEvents() return contact/event arrays; Input.clicks() returns {entity, pointer, point} records. Input subscriptions return disconnectable Events connections and callbacks receive (id, [x,y,0], device, pressure).
Constraints and behavior
- For multi-touch contacts and CanTouch-gated object click subscriptions, see Touchscreen input and object clicks, including setup, callbacks and native binding signatures. Read pointer snapshots in Update. The embedded Play viewport forwards held KeyW, KeyA, KeyS, KeyD, ArrowUp, ArrowDown, ArrowLeft, ArrowRight, ShiftLeft, and ShiftRight. Mouse button and wheel queries work in embedded Play and packaged desktop games. Start a click over the game image and release inside it. Focus the packaged game window for keyboard input. Editor-launched New Window has no keyboard or mouse bridge. 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.