Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    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:
    91
    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,361
    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:
    91
    Thanks a lot thats really helpful!