Search Unity

Xbox sticks generating phantom input, causes PlayerInput's control scheme to change

Discussion in 'Input System' started by geordiemhall, Nov 12, 2020.

  1. geordiemhall

    geordiemhall

    Joined:
    Jun 6, 2020
    Posts:
    20
    Hi there,

    This could be similar to https://forum.unity.com/threads/xbox-analog-stick-input-jolt-when-not-pressed-and-unplugged.1002834/ and https://forum.unity.com/threads/keys-getting-stuck.887656/ but thought I'd make another thread with some more details in case.

    I've been seeing some weird behaviour on macOS with a wireless Xbox One controller, where inputs will occasionally come through despite not touching the controller at all, which then causes PlayerInput to change control schemes to Gamepad.

    Not sure if actually related, but it seems to happen fairly reliably when alt-tabbing out of Unity.

    Have attached a screenshot of me stepping through InputUser generating event, which PlayerInput receives and decides to switch to the Gamepad control scheme. Not sure if relevant, but control.EvaluateMagnitude() seems to return a different value than when it's called passing in the state ptr.

    Additionally calling ReadValueAsObject() on these events will sometimes show it has a non-zero Vector2 value, yet IsActuated() still returns false. Eg. This event from the D-Pad (while controller just sitting on my desk) had x = {float} -0.707107008 y = {float} 0.707107008 but IsActuated(0f) returned false.

    Often it's the left stick that generates an event, so I thought maybe just need to mark the left stick as noisy or have PlayerInput check the default deadzone for stick controls before switching control schemes, but the fact that something very discrete like a d-pad can also generate bad events makes me wonder if it's something else.

    I've watched these inputs come through with gamepad-tester.com open in Chrome too and it doesn't show anything being received, so perhaps it's something on the Unity side rather than a bug in the Mac/Xbox drivers?

    I'll try to do some more testing on Windows with wired/wireless controllers, or can try out other things if you have ideas for potential fixes. May have to just ignore sticks/d-pads for switching control schemes for now though?

    FYI I've also tried updating to 1.1.0-Preview2, and changing the Update Mode to "Process Events in Fixed Update" but neither seemed to fix.

    Cheers,
    Geordie
     

    Attached Files:

    Last edited: Nov 16, 2020
  2. Francoimora

    Francoimora

    Joined:
    Aug 1, 2013
    Posts:
    68
    2024 and it's still there... did you find a way to fix it ?
     
  3. Mackerel_Sky

    Mackerel_Sky

    Joined:
    Jul 24, 2018
    Posts:
    26
    I think I might be running into a similar issue - I haven't got any Xbox Controllers at home, but have been receiving intermittent feedback from some players that some scenes caused their controls to lock up.

    Investigation determined that the controllers were detected by Unity but weren't talking to their maps. In my screenshot you can see that the D-pad is returning 0.71, 0.71 - which seems to round to the values being seen by OP?
     

    Attached Files: