Unity and il2cpp

NatNet, VRPN, TrackD, and Plugins
Post Reply
Archtica
Posts: 2
Joined: Thu Nov 17, 2022 2:44 am

Unity and il2cpp

Post by Archtica » Thu Nov 17, 2022 5:20 am

Hello all, quick unity question
Is it possible to run the unity OptiTrack plugin in unity il2cpp. I'm getting marshalling errors.
Before diving deeper I just want to know or if I need to do something in particular. Mono works fine, but that is not an option for me.

Code: Select all

NotSupportedException: IL2CPP does not support marshaling delegates that point to instance methods to native code. The method we're attempting to marshal is: NaturalPoint.NatNetLib.NatNetClient::FrameReceivedNativeThunk
Like so:

I've tried making the client.cs methods static as per the errors message and it builds but crashes on enabling the component.

Code: Select all

internal class MonoPInvokeCallbackAttribute : System.Attribute
{
  public MonoPInvokeCallbackAttribute() { }
}
[MonoPInvokeCallback]
static private void FrameReceivedNativeThunk( IntPtr pFrameOfMocapData, IntPtr pUserData )
{
Thank you in advance!
Regards Thomas

Post Reply