Search Unity

[unity editor plugin] threading question :

Discussion in 'Scripting' started by Agross, Aug 1, 2014.

  1. Agross

    Agross

    Joined:
    Aug 1, 2014
    Posts:
    1
    Hello.

    OK, I understand that the Unity Engine is a pure reactor design with various constraints, but what about the Unity Editor ?

    We need to create a proof-of-concept plugin for Unity that requires embedding an asynchronous RPC.
    The RPC can both send and recv calls asynchronously. The send part can be taken care easily with a send queue, but recv needs to inject events ( coroutines ) into the main loop.
    However, from the API it is not clear if the event loop supports injecting events from another thread.

    Technically, most event based systems like Unity allow locking the event queue and injecting an event from another thread which will be processed on the main thread ( or, in any case, the reactor loop thread )

    Polling is out of the question ( bad engineering and too slow/resource consuming ).

    Thank you.
     
  2. LightStriker

    LightStriker

    Joined:
    Aug 3, 2013
    Posts:
    2,717
    The editor is the same as the engine... because it's built around the same engine.
    Which means, absolutely no multi-thread for any object or method that have calls towards the unmanaged side of Unity.

    Sorry, but I don't see why the receive part cannot be queue until the main thread loop over them.

    It's not supported.

    What makes you think Unity is event based?