Is there a way to get the joystick ID of the gamepad used to perform an action?

Hi, I’m working on a co-op game at the moment. I’ve already looked at using Player Input to bind the actions to the different players but it doesn’t seem to solve the issue of figuring out which controller performed which action.

Is there a simple way of finding out which controller used which action in the new experimental input system?

I didn’t find anything to detect which controller number is. What we did four our game instead was handling it the other way around, like suggested here . We detect unpaired devices and assign it to a user. After that we read gamepad values directly but in that link they suggest creating a new instance of the player input asset and map it to the user when pairing a new device. I tested that and seems to work but we didn’t need it in our game so we avoided it. If you want you can check our code here to see what we did instead.

1 Like

Thanks, I’ll have a look at your code, and try and do something similar.

You might also want to try the PlayerInputManager component, which is meant to handle instantiation of players and mapping players to different devices automatically for you.

Yep, I’ll definitely have to have a look at that once I can get everything else working.