Start with actions, not keys
The new Input System works best when you describe meaningful game actions—move, jump, interact—instead of hard-coding individual keys. The same action can then be bound to a keyboard, gamepad, or touch control.
Unity recommends an action-based workflow. This guide uses one ownership model for a single-player prototype: PlayerInput manages that player's actions. In local multiplayer, each PlayerInput can use its own action copy, so the example does not mix in a reference to the original Action Asset.
A minimal setup order
Begin with one Action Asset and the one intended PlayerInput component. An accidental second input handler can duplicate calls in a single-player scene, while multiple PlayerInput components are valid in a deliberate local-multiplayer setup.
- Install the Input System package, enable the new backend in Active Input Handling, and restart the Editor when prompted.
- Create a Gameplay Action Map and set Move to Action Type Value and Control Type Vector2. In Move's add-binding (+) menu, choose Add Up/Down/Left/Right Composite, then set each Path to Up=W, Down=S, Left=A, Right=D. To use arrow keys, assign the matching key to each direction instead. A plain Add Binding connecting one key directly to Move is not the same setup.
- Set Jump to Action Type Button and use a plain Add Binding for Space. Use Save Asset when Auto-Save is off. Add PlayerInput to the player object, attach the Action Asset, and set the Default Action Map to Gameplay.
- Read this player's Move action from PlayerInput.actions instead of the original asset. The example below reads only Move; binding Space does not implement jumping.
using UnityEngine;
using UnityEngine.InputSystem;
[RequireComponent(typeof(PlayerInput))]
public class MoveProbe : MonoBehaviour
{
private InputAction move;
private void Awake()
{
PlayerInput playerInput = GetComponent<PlayerInput>();
move = playerInput.actions.FindAction("Gameplay/Move", true);
}
private void Update()
{
Vector2 direction = move.ReadValue<Vector2>();
transform.Translate(new Vector3(direction.x, 0f, direction.y) * Time.deltaTime);
}
}
Four checks when input stays silent
Before rewriting a script, check whether Default Action Map is assigned, the Gameplay map is active, the Game view owns focus, and the single-player scene has no accidental second PlayerInput.
Reading device state directly can be useful for a quick prototype, but an action-first structure is easier to extend to rebinding and multiple devices.
Official documentation review
Verified
Reviewed against the Unity 6 and Input System documentation. This guide was not independently reproduced in a Unity project.