Search Unity

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

  2. Unity 2022.1 is now available as the latest Tech release.
    Dismiss Notice
  3. Improve your project's performance with our new guide on profiling in Unity.
    Dismiss Notice

Android, PS4 controller name is just "Wireless controller"?

Discussion in 'Input System' started by Valorware, Aug 31, 2020.

  1. Valorware

    Valorware

    Joined:
    Aug 25, 2016
    Posts:
    79
    Hi,

    I'm trying to do input for controllers for Android, as I am aware each controller has different mapping. However, currently my official PS4 controller paired with my Samsung s9 has a name of "Wireless Controller" when I use Input.GetJoystickNames(), instead of something like "Playstation 4 controller" - so it's impossible to allocate the correct mapping for that?

    I know there are some assets like InControl and Rewired, but I don't see how they can detect the controller either, if all we are given is "Wireless Controller"?

    I think at this point I might just set up a method for the user to just press in their own custom mapping

    Thank you for any information
     
  2. rz_0lento

    rz_0lento

    Joined:
    Oct 8, 2013
    Posts:
    2,305
    It has actually detected the PS4 controller on your case. I think dualshock 4's USB friendly name is just "wireless controller" so Unity decided to use the same thing instead of renaming it.

    If everything else fails, I think you can just cast your Gamepad object as DualShock4GamepadHID or DualShockGamepad (this detects PS3 controller too) and see if it implements that class.
     
    Last edited: Sep 1, 2020
    Valorware likes this.
  3. Valorware

    Valorware

    Joined:
    Aug 25, 2016
    Posts:
    79
    Thanks a lot thats really helpful!
     
unityunity