InputSystem Two Players, Two Controllers

I have recently switched to Unity’s new InputSystem as it’s far more convenient for rebinding keys. However, I’ve had trouble making it work for my 1-2 player game.
With the old system, I would assign a function to something like “joystick 1 button 1”, and player 2 would use “joystick 2 button 1”.

With the new system there doesn’t seem to be a way to differentiate between controllers, even when rebinding it’ll just assign the function to a generic ‘A button’ for example. This of course means that the characters of both player 1 and 2 are steered using the same controller.

How can I assign player 1 to always use the first controller and player 2 to always use the second?

It might be worth noting that the two players control different prefabs and they can also change their prefabs while playing (switching characters).

Thanks in advance.

The player input manager can automatically join players for multiplayer (or you can do it manually). You could watch: Local Co-op in Unity using the New Input System - Tutorial - YouTube for how multiplayer works for the new input system and watch Tutorial - Create a Local Co-Op Player Setup Screen in Unity with the New Input System - YouTube for the character selection.

I’m not on my normal computer right now so I don’t have the exact script, but this should be something like it. Instead of just testing for input from Gamepad, try Gamepad.all[playerNum].whatever_button. I’ll update this answer when I get the actual script.