Why is SetMotorSpeeds not working ?


I’m trying to make my controller rumble, I tried with a Stadia and a PS3 controller but it’s doing nothing…
I’m looking for the solution for several days, even asked to ChatGPT, it told me about activating vibrations in project settings but I can’t find this option so…

My code is below, it is simply setting Gamepad.current to the variable _gamepad, and calling SetMotorSpeeds() with the value of the right trigger (and some GUI debug).

Everything works as expected but the controller does not vibrate oO

Thanks for reading me!

using UnityEngine;
using UnityEngine.InputSystem;

namespace Player
    public class Vibrate : MonoBehaviour
        private Gamepad _gamepad;
        private float _leftMotorSpeed;
        private float _rightMotorSpeed;
        private PlayerInput _playerInput;
        private InputAction _vibrateAction;

        void Awake()
            _playerInput = GetComponent<PlayerInput>();

        void Start()
            _gamepad = Gamepad.current;
            _vibrateAction = _playerInput.actions["vibrate"];
            _vibrateAction.performed += PerformVibrateAction;
            _vibrateAction.canceled += CancelVibrateAction;

        void OnGUI()
            GUI.Label(new Rect(0, 0, 300, 20), $"{_gamepad}");
            GUI.Label(new Rect(0, 20, 300, 20), $"Left Motor : {_leftMotorSpeed}");
            GUI.Label(new Rect(0, 40, 300, 20), $"Right Motor : {_rightMotorSpeed}");

        private void PerformVibrateAction(InputAction.CallbackContext ctx)
            float value = ctx.ReadValue<float>();
            SetMotorSpeeds(value, value);
        private void CancelVibrateAction(InputAction.CallbackContext ctx)
            SetMotorSpeeds(0f, 0f);

        private void SetMotorSpeeds(float leftSpeed, float rightSpeed)
            _leftMotorSpeed = leftSpeed;
            _rightMotorSpeed = rightSpeed;
            _gamepad.SetMotorSpeeds(leftSpeed, rightSpeed);

Am I the only person having this problem right now?
The problem happens with my two computers, and it doesn’t change anything after building the game and distributing it to other people.

I don’t know, but I’m having a problem where rumble works inconsistently when the frame rate is very high, so I’m curious whether you have a very high frame rate when you’re testing this. I’m going to try putting the SetMotorSpeeds call in FixedUpdate so it runs less often.

Thanks for the post,
Yes, my framerate is around 820 FPS, but because SetMotorSpeeds is called only on the controller event I don’t see how it could be related

just tried with a Nintendo Switch Pro Controller and the issue persists.
Am I still the only human with such a problem right now ?

1 Like

Maybe you haven't read Known Limitations in the Input System manual. gamepad only works well on xbox or PS4. https://docs.unity3d.com/Packages/com.unity.inputsystem@1.6/manual/KnownLimitations.html

  • (Stadia) The Stadia controller is only supported in the Stadia player at the moment. In the editor, use the generic Gamepad for bindings and use any Xbox or PS4 controller for testing.
  • Joy-Cons are only supported on Switch.
  • Sensors in the PS4 controller are currently only supported on PS4.

And Also Nintendo Switch Pro Controller is not supported on Windows. https://docs.unity3d.com/Packages/com.unity.inputsystem@1.6/manual/Gamepad.html

Note: Only the following combinations of Devices/OSes currently support rumble:

  • PS4, Xbox, and Switch controllers, when connected to their respective consoles. Only supported if you install console-specific input packages in your Project.
  • PS4 controllers, when connected to Mac or Windows/UWP computers.
  • Xbox controllers on Windows.

Thanks a lot blingopen,
You’re right, I didn’t check this section out, sorry…
I’m quite surprised that the rumble function is not supported on a lot more controllers