Search Unity

  1. Unity 6 Preview is now available. To find out what's new, have a look at our Unity 6 Preview blog post.
    Dismiss Notice
  2. Unity is excited to announce that we will be collaborating with TheXPlace for a summer game jam from June 13 - June 19. Learn more.
    Dismiss Notice

Question Detecting Dualshock 4

Discussion in 'Input System' started by SevDavis, Apr 19, 2021.

  1. SevDavis


    Nov 12, 2015
    Hey all, I may be going about this wrong, because I'm dabbling with the input systems, but from what I understand, Unity detects Dualshock4 and other controllers as Gamepad. Is there anyway to designate the Gamepad detection in code as a Dualshock 4? And part 2 to this question is, are their any documentation to adding rumble via code?

    A massive thank you to anyone who can provide clarity or a solution to this.

  2. Disclaimer: I haven't tried this in real life, only read the documentation, so take it with a pinch of salt. I maybe wrong or it is possible that it doesn't work like it should, you will need to test it.

    I don't think you really need to detect if you have a DS4 on your hands (pun intended). You just call the method in code and if the device supports rumble it will, if it doesn't, it will ignore it. As far as I understand the situation.
  3. MollySpryFox


    May 4, 2020
    I'm not sure I fully understand the first part of your your question but if you need to detect if the current controller is a Dualshock4 you can use:
    if (UnityEngine.InputSystem.Gamepad.current is UnityEngine.InputSystem.DualShock.DualShockGamepad)