Get InputActionReference from InputAction

Hello,

I have my InputActionAsset stored in a variable :

[SerializeField] private InputActionAsset inputActions;

Looping over it, :

        foreach (InputAction item in inputActions) { }

How do I get the InputActionReference from one of the InputAction ?

I want this something like this :

        foreach (InputAction action in inputActions)
        {
            if (action == anotherAction)
            {
                InputActionReference inputActionsRef = action;
            }
        }

Thanks in advance !

EDIT : OR another solution would work for me; can I retrieve all InputActionReference from my assets and store them into a list ? I just need a List of my actions so I can iterate through it …

Well, for my use case I am using this for now :

    [SerializeField] private List<InputActionReference> l_inputActionsRef = new List<InputActionReference>();
(...)
foreach (var action in inputActions)
        {
            InputActionReference inputActionReference = new InputActionReference();
            inputActionReference.Set(action);
            l_inputActionsRef.Add(inputActionReference);
        }

And I am able to iterate through this list “l_inputActionsRef” and even though I am doing “new InputActionReference();” when I use this reference, it refers to the correct action in my InputActionAsset. So yeah, I’m good for now, but if there is a cleaner way let me know !

Well aged, this thread, but as I’m currently searching for a satisfying answer to the original question, I stumbled accross this answer and feel the need to comment, that unityenjoyeronlywhenitworks has at least one major flaw to consider:

InputActionReference is a ScriptableObject and you should never ever create a ScriptableObject with new. I guess, the system throws at least a warning about this.
From all I learned yet, one needs to load all sub assets of the InputAsset and retrieve the appropiate InputActionReference from there.
Hope, this is for some use for others, if finding this thread as well in the future.