isButtonPressed(btn?: TButton | TButton[]): boolean
If any or certain bound button(s) are just pressed last frame on any input (keyboard, gamepad).
param
btn- The button(s) to check.
onUpdate(() => {
if (!isButtonPressed()) return // early return as no button was pressed
if (isButtonPressed("jump")) debug.log("Player jumped")
if (isButtonPressed(["left", "right"])) debug.log("Player moved")
})
since
v3001.0
group
Input