Skip to content
Development
Skill

/input-system

New Input System — action maps, PlayerInput component, generated C# classes, runtime rebinding, multi-device support, input buffering.

From plugin
everything-claude-unity
2442 skills20 agents27 commands
Install
$ npx -y skills add XeldarAlz/everything-claude-unity --skill input-system --agent claude-code

How it fires

How this skill gets triggered: by you, by Claude, or both.

  • Fires itselfAuto-invocation. Claude auto-loads it when your prompt matches the work.Auto-invocation is when the right skill fires by itself at the right moment, driven by a FLOW.md router and a hook, instead of you invoking it by name. It is the difference between a skill being installed and a skill actually getting used.Read the full definition →
  • You can call itInvoke it directly when you want it.
  • Slash command/input-system

Context preview

The summary Claude sees to decide when to auto-load this skill.

New Input System — action maps, PlayerInput component, generated C# classes, runtime rebinding, multi-device support, input buffering.

SKILL.md

input-system.SKILL.md
name: input-system
description: "New Input System — action maps, PlayerInput component, generated C# classes, runtime rebinding, multi-device support, input buffering."
globs: ["**/*.inputactions", "**/Input*.cs", "**/PlayerInput*"]

Unity New Input System

Input Action Asset Setup

Create an Input Action Asset: Assets > Create > Input Actions. This is the central configuration for all input bindings.

Action Map Structure

Organize actions into maps based on context:

PlayerControls.inputactions
  |-- Player (gameplay)
  |     |-- Move (Value, Vector2)
  |     |-- Look (Value, Vector2)
  |     |-- Jump (Button)
  |     |-- Attack (Button)
  |     |-- Interact (Button)
  |
  |-- UI (menu navigation)
  |     |-- Navigate (Value, Vector2)
  |     |-- Submit (Button)
  |     |-- Cancel (Button)
  |
  |-- Menu (pause/settings)
        |-- Pause (Button)

Action Types

  • **Button**: Discrete press/release. Use for jump, attack, interact.
  • **Value**: Continuous value. Use for movement, look, triggers.
  • **Pass-Through**: Like Value but does not perform initial state check. Use for multi-device scenarios.

Generated C# Class Workflow

In the Input Action Asset inspector, check "Generate C# Class" and click Apply. This is the recommended approach.

using UnityEngine;
using UnityEngine.InputSystem;

public class PlayerController : MonoBehaviour
{
    private PlayerControls _controls;
    private Vector2 _moveInput;

    private void Awake()
    {
        _controls = new PlayerControls();
    }

    private void OnEnable()
    {
        _controls.Player.Enable();

        _controls.Player.Move.performed += OnMove;
        _controls.Player.Move.canceled += OnMove;
        _controls.Player.Jump.performed += OnJump;
        _controls.Player.Attack.performed += OnAttack;
    }

    private void OnDisable()
    {
        _controls.Player.Move.performed -= OnMove;
        _controls.Player.Move.canceled -= OnMove;
        _controls.Player.Jump.performed -= OnJump;
        _controls.Player.Attack.performed -= OnAttack;

        _controls.Player.Disable();
    }

    private void OnMove(InputAction.CallbackContext ctx)
    {
        _moveInput = ctx.ReadValue<Vector2>();
    }

    private void OnJump(InputAction.CallbackContext ctx)
    {
        // Jump logic
    }

    private void OnAttack(InputAction.CallbackContext ctx)
    {
        // Attack logic
    }

    private void Update()
    {
        transform.Translate(new Vector3(_moveInput.x, 0, _moveInput.y) * Time.deltaTime * 5f);
    }
}

PlayerInput Component

The PlayerInput component provides an easier but less flexible approach.

Behavior Modes

| Mode | Pros | Cons | |------|------|------| | Send Messages | Simple, no setup | Uses SendMessage (slow, no type safety) | | Broadcast Messages | Reaches child objects | Same issues as SendMessages | | Invoke Unity Events | Inspector-assigned, flexible | Requires wiring in Inspector | | Invoke C# Events | Best performance, type-safe | Requires code subscription |

Using Invoke C# Events

using UnityEngine;
using UnityEngine.InputSystem;

[RequireComponent(typeof(PlayerInput))]
public class PlayerInputHandler : MonoBehaviour
{
    private PlayerInput _playerInput;

    private void Awake()
    {
        _playerInput = GetComponent<PlayerInput>();
    }

    private void OnEnable()
    {
        _playerInput.onActionTriggered += OnActionTriggered;
    }

    private void OnDisable()
    {
        _playerInput.onActionTriggered -= OnActionTriggered;
    }

    private void OnActionTriggered(InputAction.CallbackContext ctx)
    {
        switch (ctx.action.name)
        {
            case "Move":
                HandleMove(ctx.ReadValue<Vector2>());
                break;
            case "Jump":
                if (ctx.performed) HandleJump();
                break;
        }
    }

    private void HandleMove(Vector2 input) { /* ... */ }
    private void HandleJump() { /* ... */ }
}

Reading Input Values

Callback Phases

action.started += ctx => { };   // Input begins (button starts pressing)
action.performed += ctx => { }; // Input completes (button fully pressed)
action.canceled += ctx => { };  // Input released

Polling in Update (Alternative)

private void Update()
{
    // Polling approach — simpler but less event-driven
    Vector2 move = _controls.Player.Move.ReadValue<Vector2>();
    bool jumpPressed = _controls.Player.Jump.WasPressedThisFrame();
    bool jumpReleased = _controls.Player.Jump.WasReleasedThisFrame();
    bool jumpHeld = _controls.Player.Jump.IsPressed();
}

Action Map Switching

public class InputMapSwitcher : MonoBehaviour
{
    private PlayerControls _controls;

    public void SwitchToUI()
    {
        _controls.Player.Disable();
        _controls.UI.Enable();
    }

    public void SwitchToGameplay()
    {
        _controls.UI.Disable();
        _controls.Player.Enable();
    }

    public void SwitchToMenu()
    {
        _controls.Player.Disable();
        _controls.UI.Disable();
        _controls.Menu.Enable();
    }
}

Composite Bindings

2D Vector Composite (WASD / D-Pad)

In the Input Action Asset, add a 2D Vector composite to a Vector2 action:

  • Up: W / D-Pad Up
  • Down: S / D-Pad Down
  • Left: A / D-Pad Left
  • Right: D / D-Pad Right

Button With Modifier

For key combos like Ctrl+S:

  • Add ButtonWithOneModifier composite
  • Modifier: Left Ctrl
  • Button: S

Runtime Rebinding

using UnityEngine;
using UnityEngine.InputSystem;
using TMPro;

public class RebindManager : MonoBehaviour
{
    [SerializeField] private InputActionReference actionToRebind;
    [SerializeField] private TMP_Text bindingDisplayText;
    [SerializeField] private GameObject waitingForInputUI;

    private InputActionRebindingExtensions.RebindingOperation _rebindOperation;

    public void StartRebinding()
    {
        actionToRebind.action.Disable();
Read more
Ships witheverything-claude-unity

The ultimate Claude Code toolkit for Unity game development. A production-ready, plug-and-play system that gives Claude Code deep Unity expertise — from writing performant C# to building scenes, profiling performance, and triggering iOS/Android builds — all

Get the whole plugin

Other skills on everything-claude-unity.