Search Unity

Detection of gamepads inconsistent

Discussion in 'Input System' started by reachdabeach, Feb 24, 2021.

  1. reachdabeach

    reachdabeach

    Joined:
    Jan 28, 2021
    Posts:
    70
    I have a project in 2019.4.1f1 in Windows that was using the old input and I added the new InputSystem; imported and then selected the option in project settings to use the new and old. Editor has been restarted many times over the span of several days since I did this. The entire system has been rebooted a couple of times. I am detecting whether or not there is a Gamepad connected so I can possibly do vibration. I switch between nothing, a "real" X Box controller on USB and an SNES controller on USB.

    My code works sometimes - when the X Box controller is there, it will sometimes detect it and vibrate. Sometimes not. Sometimes it detects the SNES; sometimes not. This is with unchanged code.

    An example run. I disconnected and reconnected the SNES on this run, just so I could get this in the console:

    gamepaddetect.jpg

    Then I run the game in the editor and stop at a breakpoint and use the Immediate window (yeah, I am old school because I am just plain old) to check InputSystem.Gamepad:

    gamepad2.png

    Other times it works.

    I use both Gamepads in other games and don't have trouble with them being recognized and used. I make sure nothing else is running that would access a gamepad and have started disconnecting and reconnecting before launching Unity.

    upload_2021-2-24_9-34-34.png
    64 bit and I have verified that Unity is also 64 bit.
     

    Attached Files:

    Last edited: Feb 24, 2021