Input Actions asset created by right-click menu does not work

In April 2021, someone else already mentioned this issue in the forums, the original post has been locked, but the issue has not really been resolved, here is the address of the original post:

I’m still experiencing the same problem in the latest Unity 2022.3.48f1 + Input System 1.11.0, here are the steps I took to reproduce it (pretty much the same as the previous poster):

In the Project window, create an Input Actions asset (named TestInputActions for convenience) via the right-click menu, configure the Control Schemes and Action Map, create a new Action and bind it to (for the sake of illustration, let’s use Jump), bind the gamepad’s ButtonSouth of the gamepad and space of the keyboard.

Reference it in the Player Input component, and use a simple script (InputLogger) to listen to the Performed event of the Action you just bound.

The code for the InputLogger looks like this


using UnityEngine;
using UnityEngine.InputSystem;

public class InputLogger : MonoBehaviour
{
    private PlayerInput _pInput;
    public PlayerInput PInput => _pInput ??= gameObject.GetComponent();

    void Start()
    {
        DisableUIActionMapOnGameStart();

        // both Jump and Sumbit binded to button south[Gamepad]/ space[Keyboard]
        PInput.actions.FindAction("Jump").performed += c => { Debug.Log("Jump"); };
        PInput.actions.FindAction("Submit").performed += c => { Debug.Log("Submit"); };

        //PInput.onActionTriggered += OnActionTriggered;
    }

    void DisableUIActionMapOnGameStart()
    {
        PInput.SwitchCurrentActionMap("UI");
        PInput.SwitchCurrentActionMap("Player");
    }

    private void OnActionTriggered(InputAction.CallbackContext context)
    {
        if (context.performed && !context.action.activeControl.noisy)
        {
            Debug.Log($"{context.action.name} {context.action.activeControl.device.name}");
        }
    }
}

Click play, and nothing happens when you press the corresponding button.

Now change the Actions of PlayerInput to None, then the Create Actions button will appear, click it to create the Input Actions asset (let’s call it PlayerInputCreatedActions).

As above, create an Action named Jump and set the same bindings.

Again, refer to it in the Player Input component, don’t change anything else, click play, and now the gamepad and keyboard will trigger the action correctly.

What’s the difference between these two Input Actions assets that makes one work and one not?

Finally figured out what’s going on, hopefully it will help someone in the future who is experiencing the same confusion

The key answer is in this seemingly unrelated post:

In short, after creating a Control Scheme, you must also configure which devices correspond to each Scheme.
image

This is mentioned at the end of the section on Control Scheme at the end of Configuring Input, which is VERY IMPORTANT.