Hello !
I am trying to make a custom manager on top on the new input system to be able to get the input actions of one specific player.
I am using a custom script next to my PlayerInput to access it.
What I would like to do is access the c# generated class instance of a certain player instead of using getters that take a string in parameters.
not like this:
m_playerInput.actions.FindActionMap("Generic").FindAction("Jump").performed += Jump_performed;
but like this:
PlayerInputsActions customActions = new PlayerInputsActions();
customActions.Generic.Jump.performed += Jump_performed;
But since, we’re referencing the inputaction asset in the PlayerInput and not the c# class (How could we?), I was afraid that we couldn’t do it. Plus, when I look at the c# class, I see that it inherits from nothing but IInputActionCollection while the actions of the PlayerInput is directly an InputActionAsset (which also inherits from IInputActionCollection) so it is not castable toward my own class, which may makes sense since it’s what I reference in the inspector, so I feel like there’s no way to use the c# class then ?
When continuing to search for a way to get my c# class, I found the attribute user of PlayerInput that allow you to access another actions attribute which is of type IInputActionCollection (Yey !), so I hoped that maybe, since my c# class inherits from this interface, I could cast it to get my c# class ? But no, it is just the same InputActionAsset as the actions directly accessible in the PlayerInput in a more generic container. So, if whatever is the inputActions, it will always be an InputActionAsset, why is it declared as an IInputActionCollection ?
So, my two final questions may be :
Is there anyway to get that c# class from the PlayerInput ?
If not, what is the purpose of this generated c# class ?
Wish you a nice day ![]()