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 :

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