Search Unity

  1. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Question Getting more than 4 gamepads working in your Unity game?

Discussion in 'Input System' started by potatomasterrace, Nov 6, 2023.

  1. potatomasterrace

    potatomasterrace

    Joined:
    May 23, 2019
    Posts:
    57
    Unity 2020.1.17f1 Input System 1.0.2

    So if I plug in 5 xbox 360 controllers (wired) and 1 modern wireless xbox controller (I think series X or something) I am able to play games such as Regular Human Basketball (which was made in Unity) with 6 players.

    However for my own game, Unity is only detecting 4 of those controller max (i.e. Gamepad.all.Count always returns 4 even when all 6 plugged in). I have tried connecting the series X controller with an xbox dongle instead of directly via the laptop bluetooth and still the limit of 4 seems to exist. Basically the first 4 controllers to connect are the ones that Unity seems to recognize and any additional ones are ignored.

    Does anyone know why my game is only detecting 4 controllers? It must be possible to detect and play with all 6 in Unity games if other Unity games such as Regular Human Basketball have done it right?

    Also note it seems all 6 come back with Input.GetJoystickNames(). That's old input system though right? So will I have to use some sort of a hybrid between new and old input system to get this all working? If yes, how would I go about it?

    Any advice much appreciated. Thanks.
     
  2. More info here. Your Input System still XInput based, which has that limitation. You need to update to newer Unity or try Rewired which AFAIK has non-XInput based mode, but investigate before you buy!
     
  3. potatomasterrace

    potatomasterrace

    Joined:
    May 23, 2019
    Posts:
    57
    Ah thanks for that. I could upgrade, but some of the assets I bought on the store aren't compatible with later versions :/. Otherwise might try rewired. Thanks.
     
  4. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    5,577
    Rewired allows you to choose your primary and secondary input sources on Windows Standalone. As of Rewired 1.1.47.0, Rewired supports Windows Gaming Input which allows you to use more than 4 Xbox controllers with all special features like vibration. Prior to 1.1.47.0, Rewired did not support Windows Gaming Input and defaulted to Raw Input + XInput and resulted in the same 4 Xbox controller limit you're seeing with older versions of Unity because XInput is limited to 4 controllers. XInput can be disabled to use Raw Input only to eliminate the 4 controller limit, albeit with caveats. Since Steam now supports Windows Gaming Input, there's no reason to use XInput anymore.

    There's a link to the free trial in my signature.
     
    Lurking-Ninja likes this.
  5. potatomasterrace

    potatomasterrace

    Joined:
    May 23, 2019
    Posts:
    57
    Thanks for the reply. Just a quick Q, will Rewired 1.1.47.0 work with Unity 2019.4.30f1 ?
     
  6. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    5,577
    Rewired works with all versions of Unity going back to 4.3. Unity 2018 and earlier builds can only be downloaded from my website. 2019+ is available on the Unity Asset Store.

    Always evaluate the free trial before buying.