Broader Controller Detection (PS4 Controller Support)
Base M2D detects controller types by checking if the paired device name matches “xinput” or “dualsense”.
A PS4 controller has the default name as “DUALSHOCK 4 Wireless Controller”. Because the device name doesn’t match, it will fall through and the controller input buttons won’t update, showing keyboard icons.
Follow these changes to ensure PS and Xbox controllers are picked up despite their name:
In UIControllerButtonManager
Add
using UnityEngine.InputSystem.DualShock;In
private void UpdateControllerType(PlayerInput playerInput)(Line 71):
Remove:
string devices = string.Empty;
foreach (var device in playerInput.devices)
{
if (device.enabled)
{
devices += device.name + ";";
}
}
devices = devices.ToLower();
if (devices.Contains("xinput"))
{
SetControllerType(EControllerType.XBOX);
}
else if (devices.Contains("dualsense"))
{
SetControllerType(EControllerType.Playstation);
}
else if (devices.Contains("keyboard"))
And replace it with:
if (string.Equals(playerInput.currentControlScheme, "Gamepad", StringComparison.OrdinalIgnoreCase))
{
Gamepad pad = playerInput.devices.OfType<Gamepad>().FirstOrDefault() ?? Gamepad.current;
SetControllerType(pad is DualShockGamepad ? EControllerType.Playstation : EControllerType.XBOX);
}
else
This will ensure both Dualshock (PS4) and DualSense (PS5) are supported. Any other controller types will fall back to Xbox icons!

💬 Comments (2)
Want to continue the conversation?