Search Unity

Bug Buggy Input from Bluetooth PS4 Controllers

Discussion in 'Input System' started by Cubester127, May 26, 2020.

  1. Cubester127

    Cubester127

    Joined:
    May 20, 2018
    Posts:
    4
    I am making a local multiplayer game using gamepad controllers as my input. I noticed that when I connect ps4 controllers via bluetooth, the input is totally messed up.

    When nothing is physically pressed, a bunch of inputs are mashed (see image attached, which uses the input tester that comes with the input package). Also, many buttons either don't do any anything or activate the wrong input.

    Idle_input.jpg

    This issue doesn't seem to happen when I connect the controller via USB wire. It also doesn't happen when I use an an XBox controller emulator such as DS4Windows (with bluetooth).

    While in Bluetooth, Unity seems to recognise that a DualShock4 has been connected in the Input Debugger window.

    Is this an issue with Unity's Input System or Windows? And how can I fix it if possible (since I don't want players having to install 3rd party input emulators to enjoy bluetooth) ?
     
    noio likes this.
  2. aaronchapin

    aaronchapin

    Joined:
    Oct 19, 2018
    Posts:
    2
    I'm investigating something similar on OSX. If the DualShock4 is connected via USB, it shows up in the input manager as expected and works flawlessly (see first image). If I disconnect the USB cable, and connect via bluetooth then it appears to be registered as a joystick named "Unknown Wireless Controller" (see second image).
     

    Attached Files:

    noio likes this.
  3. vorp

    vorp

    Joined:
    Aug 30, 2013
    Posts:
    10
    I'm seeing the exact same behavior (though I really just want the wireless function to work and haven't tried direct wiring).
    Strangely, the device worked correctly without mods on the legacy Input system. It's the new Input System that seems to complicate it.
    Anyone find a solution?
     
    Kwertii likes this.
  4. transat

    transat

    Joined:
    May 5, 2018
    Posts:
    779
    My DS4 is working fine with bluetooth and the new input system on a mac.
     
  5. rz_0lento

    rz_0lento

    Joined:
    Oct 8, 2013
    Posts:
    2,361
    For me the triggers always bind as buttons instead of axis if I use runtime rebinding on my DualShock 4. I've tried even using .WithExpectedControlType("Axis") on rebinds but it doesn't change anything regarding to this as input system still appears to accept buttons as axis (si it's always just setting these as on/off buttons).

    I also tried to remove the triggerbuttons from input system's dualshock code but it just causes the whole editor to crash.

    Edit: apparently the trigger button wins the bind because it gets triggered on quite small axis value. For example if you press the whole trigger to bottom and then hit the rebind, it'll pick the actual trigger axis when you let go (as then the axis change registers before button value change).

    Edit 2: had to do this to fix the rebind:
    Code (CSharp):
    1. m_RebindOperation
    2.    .WithControlsExcluding("<DualShock3GamepadHID>/leftTriggerButton")
    3.    .WithControlsExcluding("<DualShock3GamepadHID>/rightTriggerButton")
    4.    .WithControlsExcluding("<DualShock4GamepadHID>/leftTriggerButton")
    5.    .WithControlsExcluding("<DualShock4GamepadHID>/rightTriggerButton");
     
    Last edited: Aug 26, 2020
  6. GuitarBro

    GuitarBro

    Joined:
    Oct 9, 2014
    Posts:
    180
    Having the same problem with a Switch Pro Controller connected over Bluetooth on Windows. Bunch of inputs are spammed every frame it seems. This a pretty massive issue, any word on this?
     
  7. GuitarBro

    GuitarBro

    Joined:
    Oct 9, 2014
    Posts:
    180
    Seriously, not a single update on this since May?
     
  8. rz_0lento

    rz_0lento

    Joined:
    Oct 8, 2013
    Posts:
    2,361
    Have you tried 1.1.0.preview? They DID fix some issues on HID devices that did instant binds there.
     
  9. GuitarBro

    GuitarBro

    Joined:
    Oct 9, 2014
    Posts:
    180
    Didn't see anything in the release notes about this issue, but worth a shot in case it was fixed by a different change.
     
  10. GuitarBro

    GuitarBro

    Joined:
    Oct 9, 2014
    Posts:
    180
    Unfortunately it is as I expected. No luck with the preview, the behavior is exactly the same. :(
     
  11. GuitarBro

    GuitarBro

    Joined:
    Oct 9, 2014
    Posts:
    180
    Given the radio silence on this issue, I think I'll end up porting my code over to use InControl (which I fortunately already own) using the legacy input system. I could understand if this was just an oversight in this release version given the ridiculous state of input device support (even in 2020) but the lack of communication about what's going on is pretty much unacceptable given that this package is supposedly no longer in preview.

    Hopefully this changes but I'm not holding my breath.
     
  12. darthbator

    darthbator

    Joined:
    Jan 21, 2012
    Posts:
    169
    Jeez, I feel like not supporting the wireless mode of one of the most popular controllers on the market is a pretty big strike against the new input system :(

    I just tried the preview package and this doesn't seem to address the issue. Has anyone submitted an official bug for this issue? I assume someone else here has a better reproduction then what I have right now which is a fairly large project to strip for a pretty universal windows issue.
     
  13. rz_0lento

    rz_0lento

    Joined:
    Oct 8, 2013
    Posts:
    2,361
    Just to be clear, are you now talking about Switch Pro controller or PS4 through BT? For me the PS4 works just fine on both wireless and wired on Win 10 (minus the sillyness of triggers binding as buttons by default but it's solvable).

    As for popularity, PS4 controllers are popular (20% of PC players use them according to Steam survey) but Switch Pro is only used by 0.8% of the players so that's not that common. That being said, we all would just expect these to work out of the box.
     
  14. darthbator

    darthbator

    Joined:
    Jan 21, 2012
    Posts:
    169
    I was talking about the PS4 controller over Bluetooth. I get the same behavior as what you're describing on the switch controller over Bluetooth on all windows platforms. I get a bunch of errant input when nothing is being touched on the controller.
     
  15. GuitarBro

    GuitarBro

    Joined:
    Oct 9, 2014
    Posts:
    180
    Would be interesting to see if this also occurs with Xbox over bluetooth as well.
     
  16. darthbator

    darthbator

    Joined:
    Jan 21, 2012
    Posts:
    169
    My Xbox One controller works fine via bluetooth. I only seem to have this issue on devices that Windows supports as "Wireless Controller" while connected via bluetooth (the PS4 and switch controllers exhibit what appears to be the same issue).

    The bad inputs are coming in through the "Wireless Controller". If I connect via bluetooth and run ds4windows and enable "exclusive mode" (hiding the windows controller from the OS) bluetooth controller support works fine as an xbox 360 controller.
     
    Last edited: Sep 17, 2020
    GuitarBro likes this.
  17. GuitarBro

    GuitarBro

    Joined:
    Oct 9, 2014
    Posts:
    180
    Some good news! I discovered that my particular issue was actually due to Steam not playing nicely with Unity. Since it attempts to apply a profile for out-of-game use when not playing a Steam game (assuming you used a controller with a Steam game before), it was sending additional inputs that should not have been there. The solution is simply to exit Steam while using your controller in Unity.

    Given that most people using Unity probably also have Steam installed, I imagine this could be a headache for a lot of users.

    Bad news is that, if the PS4 Bluetooth problem is unrelated, then I have no fix for that. Sorry. Hope this helps someone though.
     
    whkona likes this.
  18. benni_mro

    benni_mro

    Joined:
    Nov 25, 2017
    Posts:
    5
    I have the same problem with PS4 contoller via bluetooth
    and steam is not the reason

    is there any solution now?
     
  19. darthbator

    darthbator

    Joined:
    Jan 21, 2012
    Posts:
    169
    Nope it seems like any controller unity supports as a "wireless controller" will have tons of erroneous inputs when paired over bluetooth. I've seen this now with the switch pro controller, the PS4 controller, and an 8bitdo controller. All controllers work as a "wireless controller" supported over USB but are completely broken on builds and in the editor when connected via bluetooth.
     
    DREBOTgamestudio and noio like this.
  20. Songe-kun

    Songe-kun

    Joined:
    Jan 6, 2021
    Posts:
    1
    Hello i had the same issue and found out some stuff.

    It might be becauce of steam, steam as this new interface/overlay for your controller that makes DS4 usable for usually non compatible game.

    My bluetooth controller would work fine, then upon opening steam the glitchy drifting would occur in unity.

    And if i stop steam completely (not just close it) and reboot my controller it would work again.

    Also you can tell if your controller is under the interface/overlay of steam, the light will be a bit brighter than it would usually.
     
    whkona likes this.
  21. noio

    noio

    Joined:
    Dec 17, 2013
    Posts:
    230
    This is what I'm seeing as well with a DS4, works fine when plugged in to USB, but when using over bluetooth, Unity detects it as a WirelessController and botches the inputs.

    Officially the controllers should be supported though, right? This page: https://docs.unity3d.com/Packages/com.unity.inputsystem@1.0/manual/SupportedDevices.html lists them as "Yes" (except — explicitly — when using the Sony USB Wireless Dongle, but that's something different from Bluetooth?)

    Update: I've submitted a bug report, Case #1310058
     
    Last edited: Jan 28, 2021
    MaciekOaky, trudeaua21 and GuitarBro like this.
  22. MaciekOaky

    MaciekOaky

    Joined:
    Nov 10, 2016
    Posts:
    6
    I'm also seeing the error now (3rd April 2021).
    DS4 Bluetooth or wired no Windows, most of the buttons don't work at all. Rotating a right stick gives a bunch of different inputs.

    Couldn't find the reported bug - can you share the link to it?
     
    DREBOTgamestudio likes this.
  23. masak

    masak

    Joined:
    Aug 14, 2011
    Posts:
    52
    https://issuetracker.unity3d.com/is...when-dualshock4-wireless-adapter-is-connected

    I also could not find it. So I sent a new bug report. Please vote.

    Here is similar one
    https://issuetracker.unity3d.com/is...onnected-via-bluetooth-while-steam-is-running
     
    ZakElbahi likes this.
  24. zackblack

    zackblack

    Joined:
    May 17, 2015
    Posts:
    76
    Having this same issue in 2020.3.0f1 and Input System 1.0.2. No Update after 8 months?? PLEASE!

    EDIT: Also tried 2021.6.f1 and Input System preview 1.1.0. No change.
     
    Last edited: May 6, 2021
  25. benthroop

    benthroop

    Joined:
    Jan 5, 2007
    Posts:
    262
    I am very, very, disappointed that this issue has persisted this long. Input System team, what are you doing that is more important than making this entirely common setup work properly?
     
    zackblack likes this.
  26. zackblack

    zackblack

    Joined:
    May 17, 2015
    Posts:
    76
  27. zackblack

    zackblack

    Joined:
    May 17, 2015
    Posts:
    76
    Just enable preview packages, go to the Input Manager and click "show more versions"
     
    Lurking-Ninja likes this.
  28. Ah, my UPM package cache was acting up again. (I only had the 1.1 preview 2...) Now I have preview 5!
     
    zackblack likes this.
  29. zackblack

    zackblack

    Joined:
    May 17, 2015
    Posts:
    76
  30. ghos7report

    ghos7report

    Joined:
    Nov 3, 2019
    Posts:
    1
    This is not only an issue with Steam. I have the PS4 wireless controller hooked up without Steam and it absolutely does NOT work. Come on Unity, stop blaming Steam!
     
  31. You should submit a bug report because I have wireless PS4 controller and it is working properly for me.
     
  32. ivan_tbl

    ivan_tbl

    Joined:
    Sep 20, 2017
    Posts:
    5
    Not for me.
    I sometimes can get it working properly using the USB cable but never on bluetooth. It keeps pressing start/moving the player straight up
     
  33. uneatenbreakfast_unity

    uneatenbreakfast_unity

    Joined:
    Dec 27, 2017
    Posts:
    5
    Running into this issue on version 2021.2.0b8.3289 - If this issue has been around for a while, does this mean that no Unity game in steam works with wireless PS4 controllers?

    I'm pretty sure I've used my PS4 controller on steam games just fine. There must be something more to it.
     
  34. GuitarBro

    GuitarBro

    Joined:
    Oct 9, 2014
    Posts:
    180
    FYI Steam has it's own controller profile support (as I discovered in my above post) which might actually band-aid over this issue in some cases, though it's a headache in others:

    Therefore while in-game the same profile may actually fix the input issue, though obviously YMMV.
     
  35. idontcareabouthis

    idontcareabouthis

    Joined:
    Jan 27, 2018
    Posts:
    9
    this is insane
     
    Teejay5, JeanLuc and FearIndigo like this.
  36. BillyWM

    BillyWM

    Joined:
    Dec 29, 2018
    Posts:
    14
    This can't be right. I wonder how closely they actually looked? As ghos7report said it happens regardless of whether Steam is open, and even after going to great lengths to shut everything Steam related down and restarting without it (disabling service in Windows config etc). It's also not "random" as the bug suggests (reporter probably just didn't look closely or isn't savvy enough). It's always "garbage" in the same predictable way for me (checking the input system's debugger) suggesting that the low-level binary messages have various bits transposed. Certainly there must be a commonality between the users who are seeing this issue, at the level of drivers, hardware, etc - but the commonality is definitely NOT Steam

    (Or rather, there is a cohort having this issue where the commonality is not Steam, and Steam causes a very similar issue for another cohort)

    Also, DS4Windows knows how to talk to my controller (including motion and touchpad, which, embarrassingly, Unity doesn't even *try*) and so do various commercial games on the market. "It's just flat broken, nothing to do about it" is absolutely wrong.

    "Yeah well look at this web-based tester" is no kind of authority at all. If you're versed in web development then you know how much that sort of thing is a second-class citizen, *AND* you're introducing additional layers to the equation - the opposite of clarifying anything
     
    Last edited: Nov 28, 2021
  37. FearIndigo

    FearIndigo

    Joined:
    Aug 17, 2017
    Posts:
    8
    Blaming steam is a massive cop out when browser device APIs work perfectly fine e.g. PS4 dual shock controllers would work as expected on https://gamepad-tester.com/ even with steam running and "hijacking" the input stack.

    This along with poor documentation makes me want to use rewired at best, at worst I will avoid using unity software wherever possible.

    Unity has seriously dropped the ball in the last couple of years...
     
  38. GuitarBro

    GuitarBro

    Joined:
    Oct 9, 2014
    Posts:
    180
    That's my suspicion as well.
     
  39. Mirvini

    Mirvini

    Joined:
    Jul 25, 2013
    Posts:
    11
    Very similar issue I've encountered, although rather than the inputs being random they just seem "wrong". For example the left joystick will send signals for the right stick as well. and the right stick sometimes sends out the "options" signal .
     
  40. ivan_tbl

    ivan_tbl

    Joined:
    Sep 20, 2017
    Posts:
    5
    The weirdest thing for me is that for the Switch Pro Controller it is the exact opposite.

    PS4: Unplayable on bluetooth (all sorts of random inputs), no problem on cable
    Switch: Perfect on bluetooth, random inputs on cable
     
  41. Sfunk1992

    Sfunk1992

    Joined:
    Jun 5, 2020
    Posts:
    16
    I can't even get a PS4 controller to work via cable let alone Bluetooth. It acts as if all the inputs are constantly being triggered randomly.
     
  42. suffron

    suffron

    Joined:
    Apr 5, 2021
    Posts:
    5
    I'm having similar issues - ps4 causing problems
     
  43. jackv471

    jackv471

    Joined:
    Aug 30, 2020
    Posts:
    3
    I thought i fixed the problem by changing settings in steam, but it just seems broken no matter what. I'm not sure why this hasn't been fixed in well over a year, if anybody has any workaround i would really like to know about it
     
  44. ReneSchleese

    ReneSchleese

    Joined:
    Jul 11, 2017
    Posts:
    9
    I'm experiencing the same issue. PS4 controller input is correct if connected with cable, but faulty if connected via Bluetooth. I can also verify that enabling Steam > Settings > Controller > General Controller Settings > PlayStation Configuration Support is causing the issue, and disabling the option and reconnecting the controller fixes it.
    What I don't understand is: How do websites like https://gamepad-tester.com/ get the input right, regardless of the Steam configuration? What about other game engines, how do they do it? There has to be a way of getting the cleaned up inputs.

    I'd appreciate it if a Unity developer could provide a statement. This is a serious setback for developing local multiplayer games with Unity.
     
    jackv471 and antonlicht like this.
  45. Bonermanceer

    Bonermanceer

    Joined:
    Jan 7, 2022
    Posts:
    3
    The diagnostics that I have read upon steam being the answer to the problem is just a coincidence to be honest. I have been having the same issues as everybody else's except for people that are on mac will never be part of this resolution BECAUSE IT WORKS WELL FOR THEM. haha :p ! I have been noticing if I use the controller for the first time on the editor it goes well. VERY well. No unintended behaviour kicks in. It's like playing on the playstation 4 if coded right. Really feels like it ! If I rehit play to end the preview in the editor now the controller starts acting like a real dumbass. So I have tried by adding the codes manually. Sadly, the same happens. The only good fix is to save the editor and reboot. I have not tried this in a build. If we go we common logic, the same would happen because the game build is created by the editor. Try that, I hope I have helped a bit. But no, Unity, this is not fixed sadly. Everything went well with a wired Xbox 360 Afterglow gamepad. With a Ps4 controller is meh, you lose alot of time in creation and so on and the same goes for the Xbox One Controller. My thoughts ? the wired controllers work and the ones that have bluetooth capabilities behave strangely. I would mark this as TO BE FIXED and not solved.
     
  46. dmytro_at_unity

    dmytro_at_unity

    Unity Technologies

    Joined:
    Feb 12, 2021
    Posts:
    212
    ReneSchleese and jackv471 like this.
  47. Bonermanceer

    Bonermanceer

    Joined:
    Jan 7, 2022
    Posts:
    3
  48. ReneSchleese

    ReneSchleese

    Joined:
    Jul 11, 2017
    Posts:
    9
    I noticed that the issue got resolved as 'Won't fix' again. I'd appreciate if one of you guys could provide a statement on why this happens, and how websites like https://gamepad-tester.com/ get the input right regardless of the local steam configuration.
     
  49. dmytro_at_unity

    dmytro_at_unity

    Unity Technologies

    Joined:
    Feb 12, 2021
    Posts:
    212
    Sorry, there was some miscommunication internally, the ticket should be postponed and not closed. We will reopen it and resolve it as fixed when it's done.

    As for technical reasons:
    - DualShock/DualSense gamepads send variety of different input reports and are not USB HID compliant. Hence why plugging it into PC and expecting it just work is not a case nowadays. The controllers have at least 3 modes of operation and will send different binary data depending on the mode. Applications can send different commands to the controller to switch between modes.
    - DualSense code that I've added recently supports all 3.
    - DualShock 4 code https://github.com/Unity-Technologi...ns/DualShock/DualShockGamepadHID.cs#L672-L812 is much older and only supports one mode. This mode is enabled by default if you connect over wire.
    - Steam sends command to switch device to another mode which breaks our code here.
    - https://gamepad-tester.com works because browsers themselves have code to support all these devices. The website will behave differently on different browsers/platforms. For example https://github.com/chromium/chromium/blob/main/device/gamepad/dualshock4_controller.cc here Chrome switches device to full mode all together. Firefox will have different implementation of this.

    The fix is to improve our DualShock 4 handling code to support other modes just like DualSense in that file.
     
    jackv471 and GuitarBro like this.