Search Unity

  1. We are migrating the Unity Forums to Unity Discussions. On July 12, the Unity Forums will become read-only. On July 15, Unity Discussions will become read-only until July 18, when the new design and the migrated forum contents will go live. Read our full announcement for more information and let us know if you have any questions.

Bug NativeInputSystem.IOCTL taking 250ms

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

  1. hugeandy

    hugeandy

    Joined:
    Nov 2, 2016
    Posts:
    135
    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:
    135
    Update, this still happens with 1.5.1
     
  3. hugeandy

    hugeandy

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