docs.unity3d.com
    Show / Hide Table of Contents

    Add and configure a Player Input component

    To use the Input System package with Visual Scripting, add a Player Input component to the same GameObject as the Script Graph and create an Input Actions asset.

    You must add the Player Input component and create the Input Actions asset before you create the Script Graph.

    Note

    If the Input System package isn't installed in your project, follow the Input System documentation's Installation guide to install the package. Go to Window > Package Manager to check your installed packages.

    To add a Player Input component to a GameObject:

    1. Go to Window > General > Hierarchy, or press Ctrl+4 (macOS: Cmd+4) to open the Hierarchy window.

    2. In the Hierarchy window, select the GameObject that you want to move with the Script Graph.

    3. With the GameObject selected in the Hierarchy window, go to Window > General > Inspector, or press Ctrl+3 (macOS: Cmd+3) to open the Inspector window.

    4. Select Add Component. The Components menu opens.

    5. In the Components menu, do one of the following:

      • Go to Input.
      • In the Search bar, enter Player Input.
    6. Select the Player Input component to add it to the GameObject.

    7. Add an Input Actions asset to the Player Input component. Do one of the following:

      • Create a new Input Actions asset.
      • Use an existing Input Actions asset.

    An image of the Unity Editor's Inspector window, highlighting the Actions section of the Player Input component on a GameObject.

    Create a new Input Actions asset

    1. Select Create Actions.

    2. Choose a location in your project to save the Input Actions asset.

    3. Select Save.

    Use an existing Input Actions asset

    1. Do one of the following:
      • Click the Actions field's object picker (circle icon) and in the SelectInputActionAsset window, select the asset.
      • Click and drag a file from your Project window and drop it into the Actions field.

    Next steps

    To configure the available options on a Player Input component, see GameObject components for input in the Input System package documentation.

    To configure an Input Actions asset, see Input Action Assets in the Input System package documentation.

    To create a simple Script Graph to capture input with Visual Scripting, see Capture input with the Input System package.

    Additional resources

    • Capture user input in an application
    • Capture input with the Input System package
    • Input event nodes
    Back to top
    Terms of use
    Copyright © 2023 Unity Technologies — Terms of use
    • Legal
    • Privacy Policy
    • Cookies
    • Do Not Sell or Share My Personal Information
    • Your Privacy Choices (Cookie Settings)
    "Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
    Generated by DocFX on 18 October 2023