Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Dismiss Notice

Question QueueEvent from Thread throws Exception

Discussion in 'Input System' started by FizzFab, Jan 15, 2021.

  1. FizzFab

    FizzFab

    Joined:
    Feb 19, 2018
    Posts:
    12
    Hey,
    I am currently setting up a custom device and I would like to queue the device state from a background thread

    According to the documentation:
    "Queueing an input event is thread-safe, which means that event generation can happen in background threads."

    However if i try to queue an event in a thread I run into this exception:

    Exception.PNG

    I tried several methods including InputSystem.QueueEvent, InputSystem.QueueStateEvent, State.From ...
    All of them throw this UnityException.

    The documentation says it should work, so am I missing somthing here?
     
    massivevr likes this.
  2. massivevr

    massivevr

    Joined:
    Jul 8, 2019
    Posts:
    2
    Any news regarding this?

    I'm hitting the same problem trying to Queue a StateEvent from a different thread.

    Code (CSharp):
    1. Shimmer3DeviceState state = new Shimmer3DeviceState() { };
    2. UnityEngine.InputSystem.InputSystem.QueueStateEvent(Shimmer3InputDevice.current, state);
    If I supply a Timestamp to QueueStateEvent() then the exception is for QueueStateEvent and not get_currentTime.
     
  3. andrew_oc

    andrew_oc

    Unity Technologies

    Joined:
    Apr 16, 2021
    Posts:
    77
    This looks like a bug as calling it from a different thread should work. We'd really appreciate a bug report via Help -> Report a bug in the Unity editor.
     
  4. massivevr

    massivevr

    Joined:
    Jul 8, 2019
    Posts:
    2