Local coop player 1 keyboard and player 2 controller OR if two controller are connected BOTH use controllers?

I’m working on a local coop project and I’ve run into an issue-

Is there anyway to make it so, if there’s only one controller plugged in then player one is on keyboard WASD controls and player two is on the controller BUT if there’s TWO controllers plugged in both players are on controller?

If I turn ON ‘skip assign gamepad player 1’ it means both controllers control player 2 and keyboard and mouse controls player 1-

However, if I turn it OFF then it works perfectly when two controllers are plugged in, but with only one plugged in then keyboard AND controller control player 1 (player 2 is unplayable).

My attempt so far was this (but it has issues):

I made this little test to see how many devices are plugged in-

Then I made it skip assign player 1 if there’s 3 input devices connected (keyboard, controller controller-)

This works!.. selectively… It works fine if the controller being unplugged is player one’s controller

Then it can switch between 2 controllers/ keyboard and controller depending on whether or not the controller controlling player one is unlpugged/ plugged in-

However, if you unplug the controller controlling player TWO then the controller and keyboard still control player one and player two cannot move. Also, unplugging player two’s controller creates a new input device?

After doing that, pressing play will default the input device count to 4 and not allow player two to move until the project is closed and reopened-

I literally have no idea what’s going on, I hope I explained it well enough :sob:

For now I’ve just decided to have player one ONLY be able to use the keyboard and ONLY player two can use the controller- so this’ll be the controls for the demo, although hopefully I’ll figure it out before I release the full game (If I do figure it out before someone replies I’ll update this thread in case anyone else in the future is stuck with the same issue!:star: )