PS4 joystick map on Iphone

Hello,

I am using this code on my Mac:

        if (Input.GetKeyDown(KeyCode.JoystickButton0))
        {
            Debug.Log("a");
        }

        if (Input.GetButton("PS4_Square"))
        //its configured in editor -> project settings -> input manager
        {
            Debug.Log("b");
        }

They both work on editor, printing the logs…

But when I use them on IPhone build (changing the debug for something else…)

It just dont work… But the PS4 controller work for " Input.GetAxis(“Horizontal”);", for example…

I thinks its the mapping for buttons only… on the IPhone.

Where can I get this information?

square = 16
x = 15
circle = 14
triangle = 13
R2 = 12
L2 = 11
R1 = 10
L1 = 9
dpad left = 8 //dpad’s dont map as buttons on editor
dpad down = 7
dpad right = 6
dpad up = 5
//4, 3, 2???tried all the rest… didnt work share, “mouse button”, ps, push directionals left / right. these all work on editor
options = 1

Oh my… its completely different from editor… almost the opposite… why, unity, why…?

I can pretty much guarantee this is because the driver used on the iPhone for the controller presents the controller differently than the driver used for it on your Mac.

1 Like

If you want alternatives, Unity plugins exist that will try to automatically recognize gamepads and standardize their inputs. I’m currently using one called “Rewired” (though I have not tried to use gamepads on a phone).

2 Likes

Yeah, I figure it out this… And I need to use on an Android too, so I am looking towards this kind of plugins and so on…

Thanks.

1 Like