playtest-unity/playtest/Library/PackageCache/com.unity.visualscripting@1.../Documentation~/vs-nodes-events-input-syste...

3.8 KiB

On Input System Event Float node

[!NOTE] The On Input System Event Float node [!includenodes-note-package]

The On Input System Event Float node lists for a specific Input Action from a Player Input component. The node can output a single float value.

Use this node when you want to read user input and return a single value, such as an axis value or input from a trigger on a controller.

An image of the Graph window. An On Input System Event Float node displays with its details in the Graph Inspector.

Fuzzy finder category

The On Input System Event Float node is in the Events > Input category in the fuzzy finder.

Inputs

The On Input System Event Float [!includenodes-inputs]

[!includenodes-input-system-ports]

Controls

The On Input System Event Float [!includenodes-controls]

[!includenodes-input-action-change]

You can also set this control from the Graph Inspector.

Additional node settings

The On Input System Event Float [!includenodes-additional-settings]

[!include[nodes-coroutine](./snippets/nodes-coroutine.md)]
Name Type Description

Outputs

The On Input System Event Float [!includenodes-outputs]

[!include[nodes-input-system-output-trigger-port](./snippets/input-system/nodes-input-system-output-trigger-port.md)]
Name Type Description
Float Value Float A float output port.
Visual Scripting uses your chosen Input Action and its configuration in your Input Actions asset to determine the float 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 Float node uses the bindings assigned to the Lift Input Action. When a user presses any key from the Lift binding, Visual Scripting takes the float value it receives from the Input System and sends it as an input to the Vector 3 Create node's Y input port. At the same time, Visual Scripting triggers the Transform Set Position node and uses the output from the Vector 3 Create node to set a new position for the Script Machine's GameObject.

An image that displays the Graph Editor. An On Input System Event Float node has its float output port connected to a Vector 3 Create node, and its output control port connected to a Transform Set Position node.

For this example, Lift uses a Right Trigger from a Gamepad input device as a binding. When a user presses the Right Trigger, the Y value of the GameObject's transform increases, which makes the GameObject move upwards in the scene.

[!includevs-nodes-related] On Input System Event Float node: