Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Native plugin IUnityEventQueue

Discussion in 'Documentation' started by DAVco, Mar 3, 2017.

  1. DAVco

    DAVco

    Joined:
    May 27, 2013
    Posts:
    7
    I am writing a native C++ plugin for my Unity application and I am finding it necessary to send information back to managed code and perform some action on the 'main' Unity thread.

    Currently, I achieve this by registering a callback to managed code in my unmanaged dll which is triggered at the appropriate point and the results are picked up on the main thread during the 'update' loop.

    I have noticed the IUnityEventQueue.h file in the Unity Plugin API interfaces which, from the comments in the file, seems to suggest I can use it to do what I want (issue an event that is then picked up on the Unity main thread). However, I can't seem to find any examples or documentation which show this being done - the example in the file itself only (vaguely) shows communication between plugins.

    Does there exist any further documentation or examples showing Unmanaged->Managed communication using the IUnityEventQueue?
     
  2. holo-krzysztof

    holo-krzysztof

    Joined:
    Apr 5, 2017
    Posts:
    77
    I'd also be interested in this - if there's any possibility to subscribe to those events directly from the managed side without having to pass delegates to native code?

    @DAVco, did you find a solution, by any chance?
     
  3. jpvanoosten

    jpvanoosten

    Joined:
    Nov 20, 2009
    Posts:
    47
    I am also wondering about this...

    5 years later...