We have a plugin that we “wrapped” and call into using the standard AndroidJavaClass and AndroidJavaObject classes.
Some of the methods accept callbacks, and for that we use the AndoidJavaProxy class, that is passed to the plugin code and gets invoked automagically by Unity.
The issue is, the callback is raised on an arbitrary thread (may be the UI thread or some other worker thread) that is NOT Unity’s scripting thread.
Is there any infrastructure for easily marshalling calls to the scripting thread (automatically) ?
Currently we have a scene object and we enqueue the callbacks on it. That object runs its Update() methods and raises the callbacks (on the scripting thread).
I am looking for a built-in and easy way of doing the same.