← Back to all addons

Broader Controller Detection (PS4 Controller Support)

Posted by Soho on Aug 31, 2026 at 12:21 PM

Bug Fix

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

  1. Add using UnityEngine.InputSystem.DualShock;

  2. 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)

Gyvr Aug 31, 2026 at 12:23 PM
Oh wow! I didn’t even know this was the case! I don’t own a Dualshock controller so I wasn’t able to test, thanks for this!!!
❤️ 1
Soho Aug 31, 2026 at 12:25 PM
No worries! I just picked one up so I can start testing controller inputs. Might be worthwhile changing the code to this in the next eventual update
💯 1

Want to continue the conversation?