Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.

Bug Gamepad detected even when disconnected. (Reproduceable)

Discussion in 'Input System' started by coatline, Jun 22, 2022.

  1. coatline

    coatline

    Joined:
    Jul 31, 2019
    Posts:
    16
    I am using a single wired Xbox Controller aka XInputControllerWindows for these tests. No other device is plugged in. I am not using any InputSystem.AddDevice in any part of my code nor the PlayerInputManager component.

    Steps for reproducing the bug:
    The following works every single time for me:

    Connect controller. Enter playmode. Disconnect controller (Controller is now under disconnected tab). Exit playmode. Plug in controller (controller still shows disconnected). Enter playmode. Exit playmode. Disconnect (still shows under devices tab). Enter playmode (still shows under devices tab).
    upload_2022-6-21_20-9-57.png
    Then plug it back in, and this happens:
    upload_2022-6-21_20-50-50.png
    When I disconnect it again, the second "ghost" gamepad goes under the disconnected tab but the first one stays under the Devices tab (debug looks just like the 1st screenshot now).

    It keeps displaying this even when I enter and exit playmode. My code even detects the extra device and spawns another player.

    Restarting the Editor:
    The gamepad is no longer detected. Before entering playmode, everything works fine. I unplug it, no more device detected. Plug it back in, detected. This seems to be the only way to correct the "ghost" gamepad.



    One other problem:
    Unplug during playmode, the debug menu shows it as disconnected. I stop playmode and then plug it back in. It still shows as disconnected. Then I enter playmode and it is not in the list InputSystem.devices nor InputSystem.disconnectedDevices when the Start function is called. It appears under Devices in the debug menu.
    Part 2 to the other problem:
    Sometimes I plug in my controller and it does not update in the devices tab. Then I enter playmode and the same problem arises. (When I enter playmode, it is not in the list InputSystem.devices nor InputSystem.disconnectedDevices when the Start function is called. It appears under Devices in the debug menu.)
     

    Attached Files: