Search Unity

Bug [Update] 2 XBox Gamepads on PC + Control Schemes = Two controllers giving input to one PlayerInput

Discussion in 'Input System' started by UnkelRambo, Jan 10, 2023.

  1. UnkelRambo

    UnkelRambo

    Joined:
    Oct 26, 2012
    Posts:
    80
    Hi,

    I've seen this reported in some older threads but I thought I'd post again since I have an URGENT need to resolve this. I'm on Input System v1.3.0.

    OBSERVED:

    On PC, when I plug 2 XBox One controllers in and set the Input Manager to "Join Players When Button Is Pressed", pressing the A button on the first gamepad creates the expected PlayerInput containing prefab. However, pressing the A button on the SECOND gamepad results in the first player's object jumping and does NOT create a second PlayerInput prefab object.

    EXPECTED:

    When using multiple gamepads of the same model on PC, a new PlayerInput prefab should be created for each device separately.

    Unfortunately, I'm showing this project to some people this week and need a solution to this ASAP, even if it requires some hackery. Damn me for only getting the second XBox controller today lol

    This, btw, is 100% something I need to support for PC. I understand it's *probably* not a huge market segment that uses multiple gamepads on PC, but for testing and demo purposes this is an absolute *must have.* It also doesn't give me a ton of confidence in this working as expected on XBox as I no longer have a devkit and can't test this myself...

    If anybody has any suggestions on how to get this to work I'd appreciate any and all input!
     
  2. UnkelRambo

    UnkelRambo

    Joined:
    Oct 26, 2012
    Posts:
    80
    I started a new project, did the same setup I have now (minus all custom logic and input bindings and such) and tried this and it works fine. I'll have to dive into this and see where I went astray, this is hecking WEIRD though lol
     
  3. UnkelRambo

    UnkelRambo

    Joined:
    Oct 26, 2012
    Posts:
    80
    UPDATE: I found the issue. For some reason, the presence of several Control Schemes was causing the issue for me. I deleted all control schemes (keeping the bindings) and it fixed the issue for me. EDIT: Re-added a Mouse+Keyboard scheme to fix mouse and keyboard both being separate players (lel) and a Gamepad scheme. I think the issue was that I had a Gamepad Scheme AND an XBox Controller scheme.

    I can't imagine this is intended behavior, but if it is it's extremely counter-intuitive. Actually, I just skimmed through the documentation for Control Schemes again and came across the particular bit:

    "
    Remarks
    No two entries will be allowed to match the same control or device at runtime in order for the requirements of the control scheme to be considered satisfied. If, for example, one entry requires a "<Gamepad>" and another entry requires a "<Gamepad>", then at runtime two gamepads will be required even though a single one will match both requirements individually. However, if, for example, one entry requires "<Gamepad>/leftStick" and another requires "<Gamepad>, the same device can match both requirements as each one resolves to a different control.

    It it allowed to define control schemes without device requirements, i.e. for which this property will be an empty array. Note, however, that features such as automatic control scheme switching in PlayerInput will not work with such control schemes.
    "

    I *think* my problem was having a "gamepad" and "xbox" (whatever the mapping is) control scheme.

    Anyway, might not be a bug I guess, but if somebody else gets SMOTE by this issue, hope this helps ^_^
     
    Last edited: Jan 11, 2023