docs.unity3d.com
Search Results for

    Show / Hide Table of Contents

    Actions and Player Input component workflow

    Follow this workflow to connect actions to methods on your GameObjects without code that finds the actions, for event-driven input and local multiplayer.

    The Player Input component adds a layer on top of actions. Instead of finding actions and reading their values in your scripts, as in the Actions workflow, you connect actions to methods on your GameObjects, and the component calls your methods when the player performs the actions. The Player Input Manager component uses Player Input components to add players when input occurs on new devices, which helps with local multiplayer. To compare the workflows, refer to Input System workflows comparison.

    To respond to input through the Player Input component, complete the following tasks:

    1. Configure actions in the Input Actions Editor.
    2. Add a Player Input component to your player.
    3. Connect actions to your methods.
    4. Optional: Add players for local multiplayer.

    Configure actions in the Input Actions Editor

    Define your actions and bindings in the Input Actions Editor, or start with the default project-wide actions. For instructions, refer to Create and assign a default project-wide actions asset and Configure actions.

    Add a Player Input component to your player

    To add a Player Input component to your player:

    1. Add a Player Input component to the GameObject that represents the player in your game.
    2. Assign your action asset to the Actions property.
    3. In Default Map, select the action map for gameplay, such as Player.

    For more information, refer to Get started with the Player Input component.

    Connect actions to your methods

    The Behavior property of the Player Input component sets how the component calls your methods:

    • Send Messages: The default behavior. It calls a method named On followed by the action's name, on the same GameObject. For example, the Move action calls void OnMove(InputValue value), and the Jump action calls OnJump. The method name starts with a capital letter even if the action name doesn't.
    • Invoke Unity Events: Lets you connect each action to any method in the Inspector window.

    For more information, refer to Select a notification behavior. For instructions to connect actions with Unity events, refer to Configure Unity events.

    If you access the actions in your scripts, use the component's actions property instead of InputSystem.actions, because the component can use its own copy of the actions.

    Add players for local multiplayer

    To let new players join when they press a button on their own device:

    1. Make your player GameObject a prefab.
    2. Add a Player Input Manager component to a GameObject in your scene.
    3. Assign your player prefab to the Player Prefab property of the Player Input Manager component.

    For example, in a four-player local cooperative game, when a player presses Start on their controller, the Player Input Manager component creates an instance of the player prefab for them.

    For more information, refer to Set up the Player Input component for local multiplayer and The Player Input Manager component.

    Additional resources

    • Input System workflows
    • Input System workflows comparison
    • The Player Input component
    • Local multiplayer scenarios
    In This Article
    Back to top
    Copyright © 2026 Unity Technologies — Trademarks and terms of use
    • Legal
    • Privacy Policy
    • Cookie Policy
    • Do Not Sell or Share My Personal Information
    • Your Privacy Choices (Cookie Settings)