Search Unity

Bug NativeInputSystem.IOCTL taking 250ms

Discussion in 'Input System' started by hugeandy, Apr 26, 2023.

  1. hugeandy

    hugeandy

    Joined:
    Nov 2, 2016
    Posts:
    131
    Hi,

    We've occasionally been seeing a strange performance hit in our game and we've been trying to pinpoint it for a while. Today I noticed the following entries in the log at the same time as this performance drop:

    Code (CSharp):
    1.  [16:27:19.340] Joystick reconnected ("Xbox Bluetooth Gamepad").
    2. [16:27:19.698] Joystick disconnected ("Xbox Bluetooth Gamepad").
    So I made a dev build and ran the profiling whilst disconnecting and reconnecting my USB bluetooth receiver (which my gamepad is connected to). Whilst disconnecting the receiver causes
    InputManager.Update
    a spike at 46ms, the worst offender is the reconnection which causes around 20 frames in a row where a call to
    NativeInputSystem.IOCTL
    takes 250ms.

    This call to
    NativeInputSystem.IOCTL
    originates from our controller rumble system which is calling
    Gamepad.SetMotorSpeeds
    every frame in order to set the controller rumble amount.

    Has anyone experienced this before, or have any idea of what is causing it and how to avoid it?

    *Edit
    We're using version 1.4.1, in Unity 2021.3.15f1
    Noticing this in PC standalone builds

    Cheers,
    Andy
     
    Last edited: Apr 26, 2023
  2. hugeandy

    hugeandy

    Joined:
    Nov 2, 2016
    Posts:
    131
    Update, this still happens with 1.5.1
     
  3. hugeandy

    hugeandy

    Joined:
    Nov 2, 2016
    Posts:
    131
    I have submitted a bug report of this