How to correctly detect the connected gamepad type?

Viewed 30

I'm trying to detect the type of controller connected to Unity. Here is what I have done:

var gamepad = Gamepad.current;
        var keyboard = Keyboard.current;
        if (gamepad == null && keyboard == null)
            return; // No gamepad connected.
        if (gamepad != null )
        {
            print(gamepad.displayName);
        }

and I have ps4 wired controller connected to my PC, but when I run the game This is what I get : enter image description here

How is this even happening? Why doesn't print Xbox Controller when the PS4 controller is the one that is connected?

1 Answers

I would guess whatever drivers / software you are using to make the PS4 controller work on Windows give it that display name. I don't think PS4 controller has official drivers / support for Windows.

Related