I’ve been trying to setup my game to be locally co op. I absolutely can not get controller 1 to = joy num 1 . No matter what i do the controls get jumbled. The xbox controller thats marked as player to will register under joy num 7. I’ve restarted my computer and done them one at a time with no success.
Is there something im doing completely wrong or is this a bug?
It’s a well-known issue among many (many) other bugs/issues in UnityEngine.Input. Simply put, Unity’s input system is completely inadequate for multi-player joystick games. That’s the reason why I wrote Rewired in the first place – to create a system that would make joysticks work like you’d expect them to in the first place for multi-player games, among many other features.
If you do want to use UnityEngine.Input, you will have to:
Create duplicate input Action entries for every possible joystick ID.
Detect which ID the joystick is currently at by using the Input.GetJoystickNames() array index and adding 1 to get the Unity Joystick ID. However, this method only works on certain platforms while other platforms do not align the index to the joystick id. Additionally, on some platforms when you plug in or unplug a joystick, it can cause the IDs of all attached joysticks to change.
You make a good point. I bought your asset but i have a new problem, unrelated to the asset. I restart my computer and see i have both xbox controllers lit up as Player 1 and Player 2. They work as expected until i open unity. Unity opens and i hit play and they both work properly. Then after a few seconds player 2 stops working completely. Even on other games besides unity it doesnt work at all. The only fix is to restart my computer (unplugging and replugging it in / reconnecting controller does not do anything). Ive tried this with multiple controllers as well and frequently play steam games with them so this problem is caused by unity
I’ve never heard of that issue before and can’t imagine how it could happen from the standpoint of Raw Input / XInput either. All I can think of is some kind of driver problem perhaps, but you typically only need to bother with drivers for the 360 controller if you’re on Windows XP. Vista and beyond should already have drivers included. The only other thing I can think of is to try different USB ports. Is Player 2’s joystick still showing a valid light on the device? Sometimes my 360 pad flakes out due to a loose/worn USB connection and the light on it either goes off or all of them light up.