Using a PS4 controller on Mac running Unity 5

I have a Mac running OSX 10.10.2 (Yosemite) and Unity 5.0. I have a PS4 controller that is connected to the Mac via Bluetooth and I have verified that the controller is working correctly playing other games on the Mac. I also had the controller working previously with Unity 4. However, my problem is that I cannot get any input from the controller at all now I’m using Unity 5 - this happens whether using Bluetooth or a USB connection.

I have tried listening for inputs, for instance:

if(Input.GetKey(KeyCode.JoystickButton0))
{
    Debug.Log("Joystick Button 0");
}

But am not getting any output - a similar thing happens when listening for axis output. I have also tried getting Unity to list all connected joysticks using:

Input.GetJoystickNames();

However this returns an empty array. For what it’s worth I do have my controller config set up correctly using the Input panel, however I don’t think this makes a difference when just listening for the raw key inputs.

I was wondering if anyone had any pointers as to what might be going wrong, or even any suggestions of other ways to debug the problem?

I just had a similar issue with a logitech joystick.
If you make the app and setup the axis manually it seems to work fine, however I don’t know how to make it work in the editor :frowning:

Thanks for the reply, I’ve just tried building as a standalone Mac app and running it and unfortunately the controller doesn’t work with that either.

Did you go and edit the joystick controls in the options when it loads?

For example go to vertical and then move the stick for it? You actually see it change if it picks it up.

Thanks for the tip, I just tried this (I assume you’re referring to the Input configuration menu you can access when selecting graphics/input options before launching the game) - unfortunately though the app still doesn’t pick up any controller input at all (either axis movement or button presses). This is with the controller connected to my Mac with Bluetooth, and I have verified that it works when running other (retail) games.

At this stage I’m wondering if it’s worth logging a bug as everything seems to point towards Unity being the problem.

Some pictures would help, or something.

Some pictures would help, or something. http://e-six-sigma.org/

If anyone’s still wondering, I got a PS4 controller working with Unity 5.1.1f1 on a Mac (Yosemite OS 10.10). Just paired it via Bluetooth (hold home+share buttons til PS4 controller light starts flashing, then connect it in your Mac’s bluetooth settings: tutorial here: How To Use a PS4 Controller with your Mac - Player Assist | Game Guides & Walkthroughs )

You have to restart Unity if it’s already running, and restart it again if your controller turns off. I guess it connects controllers only when it boots up.

1 Like