Quantcast
Channel: Questions in topic: "dll"
Viewing all articles
Browse latest Browse all 706

Marshal C# Method with C++

$
0
0
Hi everyone, I want to call a specific method in my Unity project within an external plugin. Here is my C++ code: static void UNITY_INTERFACE_API OnRenderEventThreadSafe(int eventID) { [...] Some C++ code //Call C# Method here } My C++ code does already work on its own but now I want to call a specific Unity method. How can I manage to do this? I tried creating delegates like this #if UNITY_EDITOR [DllImport("lib")] #else [DllImport ("lib")] #endif private static extern void Method(Delegate callback); private delegate void Delegate(int number); [MonoPInvokeCallback(typeof(Delegate))] private static void DelegateMessageReceived(int number) { Debug.Log("MessageReceived " + number); } public static void Method2() { Method(DelegateMessageReceived); } But this doesn't seem to work

Viewing all articles
Browse latest Browse all 706

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>