Search Unity

OSX plugin callback problem

Discussion in 'macOS' started by Oscar-Tsang, Apr 18, 2018.

  1. Oscar-Tsang

    Oscar-Tsang

    Joined:
    Nov 7, 2012
    Posts:
    84
    I have problem on the native plugin.

    I use a native plugin to read something on server. When download completed, the plugin will call back Unity to read the data.

    But the problem is the callback function cannot call the main thread Unity, so if I access any unity's data it will exception.

    If only print the data to Log, it is ok. But if I save the data into memory it will exception.

    How can I make sure all callback function will run on main thread? Any idea?

    But the way, if using iOS build plugin will not have this threading problem. It only has problem on OSX.