How do Unity decide which is joystick 1, 2, 3, etc

Hi everyone! I’m trying to make a local-multiplayer game. And now Im working in the inputs, I have seen several videos and tutorials about this, and I have somehow it working with 4 joysticks.

But I have several question and I didnot find the answers.

For example, if I have a joystickA, in port usb 1, and joystickB in port usb 2. Unity read these like joystickA = joystick 1 and joystickB = joystick 2.

But
If I swap the port where they are plugged Unity read them like joystickA = joystick 3 and joystickB = joystick 4

Also If I plug them in other ports, Unity dont read theam at all(Unity debug “X joystick connected”) but probably is taking them like joystick 5,6,etc

I want to know How does this work to prevent any possible error. Any help is welcome!

Hello the first thing is to test !
For my own the only fact of rebooting my pc swap order of joystick
So I’m quit in the same case of you , i want to force the joystick order.

I didn’t find anything simple yet but i can provide you a link that may help :wink: