So I am having an issue with gamepads being unplugged and then plugged back in - they don’t appear in the same order as they were set up. If you have P1 and P2 playing, and P1 unplugs their controller and then plugs it back in, sometimes they are P3, and P1 is just left blank.
From this link here, pbhogan of GallantGames describes the issue in detail, stating that due to no standardizations and HID that controllers have no unique IDs, and basically Unity can’t tell its the same controller.
Is this just an unsolvable problem? If someone unplugs their controller, is the only way to make sure they are the same player to pause the whole game and ask every player-designate their controllers again? Or have things changed since then, and I am just not finding the right answer?
In short: It depends. On some platforms, it’s possible to solve, but it takes a whole lot of hoop jumping to do so. (Windows/Android: name indices align with unity id’s and it fills empty fields with “”, OSX it collapses the array but reorders the unity ids to align with the name indices, Linux hot-plugging is just broken, etc.)
Hot-plugging and robust multi-player support are the original reasons why I wrote Rewired. GetJoystickNames is just not nearly enough information to build a robust system on top of. I solved this issue by implementing native input (on a number of platforms) to get input directly from the source instead of relying on Unity’s implementation. Rewired solves this as well as a huge number of other issues and also adds a ton of extra features on top. Check out a free demo on my website or get it on the asset store here.
Dude, that plugin is fantastic! Amazing work. Only took me like 20 minutes to switch over from the extremely clumsy system I had implemented and all my original issues are gone. Will definitely be giving it a purchase come payday. Cheers for the reply!