Can't create list of InputActions

I’m trying to create a list of input actions, but when adding a new element to the list
it’s “bound” to the existing element (the first on the list), and any change made to it
is reflected on all the items.

I tried to create elements with different names in the script (as I thought that
was the problem) and they are created with the name of first element, like if a “copy”.

Like so:

public List<InputAction> Inputs = new List<InputAction>() {
            new InputAction("ActionA"),
            new InputAction("ActionB"),
};

The result was:
190506-image-2021-12-28-193126.png

I even tried GUIDs, and creating the items outside the inspector by code
and the problem persists. Every new item created is a copy of the first.

Anyone had the same problem or could help me understand if that is not possible
(I can’t see why, as you can create separate InputAction variables and they work fine)
or probably a bug.

Thanks in advance!

Hi,

This seems to be a Unity bug documented here: Unity Issue Tracker - Adding a Binding to one InputAction element in a List adds the same binding to all the other elements in the List

The fix is already released in newest InputSystem package versions. So you can consider updating InputSystem package and the issue should be gone. Tested with Unity 2022.1.0b2 and InputSystem package version 1.2.0 it seems that fix is indeed working (although there’s some other graphical issues but not as severe and may be caused by 2022.1.0b2 not the InputSystem package itself).

Of course would suggest making a full backup of your project before updating (you never know what may go wrong).