Most of this error could be that the rubber membrane is worn out and torn. Does the button feel squishy? You can find replacements on Amazon, etc., though they might not feel as great a material as the original.
Way 1: Physical key adjustment D-Pad
If you open your Dualshock 4, try to rotate the d-pad. If the down button is still loose after assembling it again, then certainly the rubber is too thin and needs changing. Otherwise, it’s probably the second case.
The rubber part, the d-pad and the plastic board can be acquired as replacement parts in Amazon but they might not feel the same as the original parts, as someone else here said. My controller is still loose and right now I’m planning on buying those colored buttons and another plastic board.
2. PS4 controller map for Unity
I just spent a few minutes finally figuring this out; figured I’d save other folks the time. 🙂 PS4 Controller Map for Unity
Buttons Square = joystick button 0 X = joystick button 1 Circle = joystick button 2 Triangle= joystick button 3 L1 = joystick button 4 R1 = joystick button 5 L2 = joystick button 6 R2 = joystick button 7 Share = joystick button 8 Options = joystick button 9 L3 = joystick button 10 R3 = joystick button 11 PS = joystick button 12 PadPress= joystick button 13 Axes: LeftStickX = X-Axis LeftStickY = Y-Axis (Inverted?) RightStickX = 3rd Axis RightStickY = 4th Axis (Inverted?) L2 = 5th Axis (-1.0f to 1.0f range, unpressed is -1.0f) R2 = 6th Axis (-1.0f to 1.0f range, unpressed is -1.0f) DPadX = 7th Axis DPadY = 8th Axis (Inverted?)
Edit2: I put a question mark after Inverted because I swear that the LeftStickY axis worked just fine with one of my scripts, but when I was using a certain test case it seemed like it was inverted. YMMV.