Search Unity

Xbox controller stopped working in Unity, but still work outside

Discussion in 'Input System' started by Entretoize, Feb 28, 2022.

  1. Entretoize

    Entretoize

    Joined:
    Feb 27, 2015
    Posts:
    59
    Hi, I building a game with Unity and test with a Xbox controller, everything worked perfectly until today, I opened Unity, changed a few lines of code unrelated to inputs, started the game mode and was unable to play with the controller.
    Keyboard bindings that shares the sames input actions works, and the previously compiled version works also.

    I tried restarting unity, rebooting but nothing change, what can I test ??

    Thanks
     
  2. Brogan89

    Brogan89

    Joined:
    Jul 10, 2014
    Posts:
    244
    I too am having this issue. Not only with an Xbox controller but with a PS4 controller as well. I tried a different machine to see if it was local to my PC but it is happening on both devices. For me, it will sometimes work for a minute or so but eventually, the controller will show up in the "Disconnected" list in the Input Debugger window.


    I'm using
    Unity Editor: 2021.2.13
    InputSystem: 1.3.0
     
  3. Brogan89

    Brogan89

    Joined:
    Jul 10, 2014
    Posts:
    244
    I've made a bug report to Unity... now we wait.
     
  4. Entretoize

    Entretoize

    Joined:
    Feb 27, 2015
    Posts:
    59
    Nice to know I'm not alone, hope they will help...
    Thank you for the bug report
     
    Brogan89 likes this.
  5. Brogan89

    Brogan89

    Joined:
    Jul 10, 2014
    Posts:
    244
    I think I finally worked out what is going on. When I have Steam closed everything works fine. @Entretoize is your game using Steamworks and is steam open while you're running your game in Unity? If so try closing the Steam client, restart Unity and see if that helps.
     
    jitterware and brykiet like this.
  6. Entretoize

    Entretoize

    Joined:
    Feb 27, 2015
    Posts:
    59
    It is interesting, yes I'm using steamworks, this is what I tried:
    - Steam open I launched Unity and game mode: xbox controller wasn't working
    - Closed Steam and launched game mode : controller was working
    - After closed the game mode I tried the controller with the "listen" button in the input action editor and it worked to.
    - Launched Steam again and the controller still worked in the input action editor
    - Launched the game mode and the controller stopped working in both the game and action editor

    Then it seems that a component takes the input ownership once launched and keeps it.
    My problem is that I'm using Mirror with Steamworks and it can't work without Steam launched. But thank you for pointing this out.
     
  7. Brogan89

    Brogan89

    Joined:
    Jul 10, 2014
    Posts:
    244
    Ah damn that's a shame. Yeah, I made sure I can run my game outside of Steam as well, so it was pretty quick to become unblocked.
    Hopefully, you can put together something quickly so you don't need the Steam client open. I honestly think this is a good practice anyway unless your game is heavily reliant on Steam's servers.

    But yeah, I think this issue is solved-ish. It must be something to do with Steam and Unity both fighting for control of the gamepad. I haven't really looked any further into why that is happening.
     
  8. leegod

    leegod

    Joined:
    May 5, 2010
    Posts:
    2,476
    how to resolve? I can't use xbox controller at all. I am using new input system, steamworks in game because need to launch on Steam.

    After run game in editor, xbox controller connected to PC does not work at all. whileas, nintendo switch pro controller works.

    I am using direct input via coding like Gamepad.current class.
     
  9. Entretoize

    Entretoize

    Joined:
    Feb 27, 2015
    Posts:
    59
    From what I remmember I recreated a fredh project and imported everything one by one...