Migrating Project from Unity 4 to Unity 5 - Native Plugin Issue

Dear all,

I was trying to migrate a project in Unity 4, where I call a Native plugin to make some computation using CUDA on the GPU.

The project was working perfectly fine in Unity 4.

I notice that the API was changed and it doesn’t allow me to call this plugin without using the callback GL.IssuePluginEvent() ( I was calling it after the endOfFrame in a coroutine)

The issue is: I need to send the GPU computations made in the dll to Unity again, and I’m not sure if it is possible. I was digging into the documentation available and on the forum to find the best way to solve this issue, however without success.

If possible, can you guide me through the best-known practice in Native Plugin computation? In particularly, in returning values from the plugin?

If you need a more detailed explanation of the problem, I can send you.

Thanks in advance,

Kind regards,


Hi Pedro,

I’m not sure what is going on in this case, but I can recommend using the example NativeRenderingPlugin provided by Unity on our Bitbucket account as a starting point for your plugin.

Are you using OpenGLCore? Try starting with the native plugin and then alter this file:


Hi Dave,

Thanks for your answer.
Yes, I’m using OpenGLCore.

I already checked the NativeRenderingPlugin example and I manage to alter it and use it on my project, however, I still have the problem of sending back some computations made inside the plugin to the main thread in C# (and these computations must be made inside the render thread).

I tried to use reference parameters (through the ref keyword), without success. Maybe there is a workaround to this problem which I’m not aware of since C# is not my preferable Code language.

Thanks again for your time helping me,

Kind regards,