Browse docson_input
On this page
Lifecycle event

on_input

Runs for each controller input packet and is the only place controller APIs (input, output, rumble, lightbar, gyro, accel, platform views) are available.

Syntax

Atlas Script
event on_input() { }

Return value

See the remarks for the returned value and runtime behavior.

Remarks

Runs for each controller input packet and is the only place controller APIs (input, output, rumble, lightbar, gyro, accel, platform views) are available. The real packet is forwarded automatically; override only the fields you change for this one packet. The parser accepts zero, one, or two declared parameter names for compatibility, but those names are cosmetic and receive no values; always use the global input and output roots.

Examples

Pressed, held, and released.atlas
event on_input() {
    if (input.pressed("L1")) {
        system.log("L1 pressed");
    }
    if (input.held("L1")) {
        output.set_button("cross", true);
    }
    if (input.released("L1")) {
        system.log("L1 released");
    }
}
Reference details are generated from the Atlas Script schema in this documentation source snapshot. Confirm release-specific behavior in the Atlas for Windows build you use.