1.9 KiB
1.9 KiB
Capturing player inputs using the input manager
To use units from the input system (input manager), the Input unit must be linked from its output data port or its input trigger to a unit. To use the old input system, set the Edit > Project Settings > Player > Active Input Handling to Input Manager (Old) or Both.
Note: The Input Manager (Edit > Project Settings > Input Manager) lists all the input types.
To enter an input in the system
- In a script graph that has an Event unit (for example Update Event), right-click on an empty spot on the graph.
A command list appears. - Select Add Unit. The fuzzy finder appears.
- In the search field, enter “get axis”.
- Select Input: Get Axis.
The Get Axis unit appears on the graph. - Label the unit in the axisName field (for example Horizontal).
WARNING: You must label the unit with the exact spelling of the units listed in the Input Manager or Unity does not recognize them.
TIP: Copy and paste the input unit name to ensure the spelling is correct. - Drag the output port from an event unit to the input port of the Input unit. Release the arrow (mouse button) so the two units are connected.
Note: Every time there is a frame cycle and if the data port is used, the Input unit receives a signal. - From the Get Axis unit, drag from the output trigger port to an input port in another unit (for example a Transform unit).
Every time the user clicks the key for the Get Axis unit (for example, the left or right arrow), the downstream unit increments.
Creating an input unit using this method might not guarantee you’ve selected a unit that is compatible with the selected event. Use the fuzzy finder by dragging from the event output port:only compatible units (that is, units that can be linked from that event) appear in the fuzzy finder.