Search Unity

Bug InputSystem Rumble should not be used with Bluetooth Controllers

Discussion in 'Input System' started by nikescar, Sep 10, 2021.

  1. nikescar

    nikescar

    Joined:
    Nov 16, 2011
    Posts:
    165
    Use the following code to set the Rumble on a Xbox Controller:
    Code (CSharp):
    1. Stopwatch stopwatch;
    2.  
    3. private void Start()
    4. {
    5.     stopwatch = new Stopwatch();
    6. }
    7.  
    8. private void Update()
    9. {
    10.     stopwatch.Start();
    11.     gamepad.SetMotorSpeeds(1f, 1f);
    12.     stopwatch.Stop();
    13.     UnityEngine.Debug.Log($"Rumble took {stopwatch.ElapsedTicks / 10000f} milliseconds");
    14.     stopwatch.Reset();
    15. }
    When the controller is connected with USB this will take a miniscule amount of time of around 0.03ms.
    When the controller is connected with Bluetooth this will take a long amount of time of around 0.70ms.

    The rumble command, once sent, will wait for a response from the controller that the command was received. The round trip is unacceptable. This shouldn't be a blocking call.
     
  2. dmytro_at_unity

    dmytro_at_unity

    Unity Technologies

    Joined:
    Feb 12, 2021
    Posts:
    212
    Oof sounds like a huge issue in our native code if we block there, would you mind to create a bug report? Thanks a lot!
     
  3. nikescar

    nikescar

    Joined:
    Nov 16, 2011
    Posts:
    165
    Sorry, I forgot to include that:
    (Case 1364574) InputSystem uses too much CPU when setting rumble on a Bluetooth controller
     
    dmytro_at_unity likes this.