InputAction
Defines a gameplay action mechanic. These actions are then mapped to hardware inputs using InputBinding.
Memory category | Instances |
---|
Member index 11
Description
InputAction
defines a gameplay action mechanic such as "Jump," "Sprint," or
"Shoot." These actions are then mapped to hardware inputs using
InputBinding. An InputAction
will check for its first ancestor type
of InputContext and register itself to that context (if there is no
ancestor context, it will be registered to a default context).
History 15
- 677 Add Direction3DState
- 676 Add Direction2DState
- 676 Add Direction1DState
- 676 Add BoolState
- 674 Change Parameters of Fire from (value: Variant) to (state: Variant)
- 663 Change Category of Type from Data to Behavior
- 663 Change Category of Enabled from Data to Behavior
- 661 Add StateChanged
- 661 Add Released
- 661 Add Pressed
- 661 Add GetState
- 661 Add Fire
- 661 Add Type
- 661 Add Enabled
- 661 Add InputAction
Members 11
BoolState
Type | Default | |
---|---|---|
bool | false |
Security | RobloxScriptSecurity |
---|---|
Thread safety | ReadSafe |
Category | Data |
Loaded/Saved | false |
Direction1DState
Type | Default | |
---|---|---|
float | 0 |
A non-scriptable read-only property only visible in Studio, primarily
useful for debugging while testing an InputAction
with
Type of Direction1D.
Security | RobloxScriptSecurity |
---|---|
Thread safety | ReadSafe |
Category | Data |
Loaded/Saved | false |
History 1
- 676 Add Direction1DState
Direction2DState
Type | Default | |
---|---|---|
Vector2 | 0, 0 |
A non-scriptable read-only property only visible in Studio, primarily
useful for debugging while testing an InputAction
with
Type of Direction2D.
Security | RobloxScriptSecurity |
---|---|
Thread safety | ReadSafe |
Category | Data |
Loaded/Saved | false |
History 1
- 676 Add Direction2DState
Direction3DState
Type | Default | |
---|---|---|
Vector3 | 0, 0, 0 |
A non-scriptable read-only property only visible in Studio, primarily
useful for debugging while testing an InputAction
with
Type of Direction3D.
Security | RobloxScriptSecurity |
---|---|
Thread safety | ReadSafe |
Category | Data |
Loaded/Saved | false |
History 1
- 677 Add Direction3DState
Enabled
Type | Default | |
---|---|---|
bool | true |
Determines if the InputAction
is enabled or not. The action state will
be reset if this property is toggled to false
.
Thread safety | ReadSafe |
---|---|
Category | Behavior |
Loaded/Saved | true |
Fire
Parameters (1) | ||
---|---|---|
state | Variant | |
Returns (1) | ||
null |
Updates the InputAction
to the given state and fires the appropriate
signals. This method is most useful for script‑triggered "input" where the
passed state
should trigger events like
Pressed or
StateChanged regardless of whether the
player triggered that state through normal inputs.
This method will only accept a state
parameter that matches the
Type and attempting to call it with a mismatched
type will cause an error, for example passing a state of 0.5
when the
Type is Bool.
Note that this method follows the conditions of
Pressed,
Released, and
StateChanged. For example, if you make
multiple consecutive calls to Fire()
with a state of true
,
StateChanged will only fire on the first
state change and the subsequent calls to Fire()
will do nothing.
Thread safety | Unsafe |
---|
GetState
Parameters (0) | ||
---|---|---|
No parameters. | ||
Returns (1) | ||
Variant |
Returns the current state of the InputAction, for example true
for an action with Type set to
Bool.
Thread safety | Unsafe |
---|
Pressed
Parameters (0) | ||
---|---|---|
No parameters. |
This event fires only when the Type is set to
Bool, and only when the state transitions from
false
to true
.
Thread safety | Unsafe |
---|
Released
Parameters (0) | ||
---|---|---|
No parameters. |
This event fires only when the Type is set to
Bool, and only when the state transitions from
true
to false
.
Thread safety | Unsafe |
---|
StateChanged
Parameters (1) | |
---|---|
value | Variant |
This event fires for all InputActionType types whenever the state changes, except if the state attempts to transition to the same state.
Thread safety | Unsafe |
---|
History 1
- 661 Add StateChanged
Type
Type | Default | |
---|---|---|
InputActionType | Bool |
Specifies what type of input value the action is expecting. See InputActionType for more details.
Thread safety | ReadSafe |
---|---|
Category | Behavior |
Loaded/Saved | true |