3.7 KiB
On Input System Event Vector 2 node
[!NOTE] The On Input System Event Vector 2 node [!includenodes-note-package]
The On Input System Event Vector 2 node listens for a specific Input Action from a Player Input component. The node can output two values as a Vector 2.
Use this node when you want to read input and return two values, such as a joystick or mouse position.
Fuzzy finder category
The On Input System Event Vector 2 node is in the Events > Input category in the fuzzy finder.
Inputs
The On Input System Event Vector 2 [!includenodes-inputs]
[!includenodes-input-system-ports]
Controls
The On Input System Event Vector 2 [!includenodes-controls]
[!includenodes-input-action-change]
You can also set this control from the Graph Inspector.
Additional node settings
The On Input System Event Vector 2 [!includenodes-additional-settings]
[!include[nodes-coroutine](./snippets/nodes-coroutine.md)]Name | Type | Description |
---|
Outputs
The On Input System Event Vector 2 [!includenodes-outputs]
[!include[nodes-input-system-output-trigger-port](./snippets/input-system/nodes-input-system-output-trigger-port.md)]Name | Type | Description |
---|---|---|
Vector 2 Value | Vector 2 | A Vector 2 output port. Visual Scripting uses your chosen Input Action and its configuration in your Input Actions asset to determine the Vector 2 value returned by this port. See the Example graph usage section for an example. For more information about how to configure Input Action settings and use an Input Action asset, see Input Action Assets in the Input System package documentation. |
Example graph usage
In the following example, an On Input System Event Vector 2 node uses the bindings assigned to the Move Input Action. When a user presses a button from the Move binding, Visual Scripting takes the Vector 2 value it receives from the Input System and sends it as an input to the Transform Set Position node's Value input port. The Vector 2 value changes the position of the GameObject associated with the Target transform.
For this example, Move uses the W, A, S, and D keys. The GameObject moves up in the scene when the user presses W, moves down when the user presses S, and moves left or right when the user presses A or D.
Related nodes
[!includevs-nodes-related] On Input System Event Vector 2 node: