Phidget RFID & Unity IL2CPP Builds
Posted: Wed Jun 22, 2022 10:02 am
Hey,
We are trying to get the Phidget RFID device to work with IL2CPP Builds. Mono works fine, but IL2CPP throws the following exception when running the build, right after calling
Any ideas how we can solve this?
Cheers,
Dirk
We are trying to get the Phidget RFID device to work with IL2CPP Builds. Mono works fine, but IL2CPP throws the following exception when running the build, right after calling
Code: Select all
private static RFID _rfid;
private static void OpenDevice()
{
_rfid = new();
...
}
Seems we are not even getting to the point where other 3rd party developers recommend to use the following attribute on static callback methods:NotSupportedException: IL2CPP does not support marshaling delegates that point to instance methods to native code. The method we're attempting to marshal is: Phidget22.Phidget::nativeAttachEvent
at Phidget22.Phidget22Imports.Phidget_setOnAttachHandler (System.IntPtr phid, Phidget22.Phidget22Imports+AttachEvent fptr, System.IntPtr ctx) [0x00000] in <00000000000000000000000000000000>:0
at Phidget22.Phidget.initializeBaseEvents () [0x00000] in <00000000000000000000000000000000>:0
at Phidget22.RFID.initializeEvents () [0x00000] in <00000000000000000000000000000000>:0
at Next.Experimental.PhidgetRFID.PhidgetRFID.OpenThread () [0x00000] in <00000000000000000000000000000000>:0
at System.Threading.ExecutionContext.RunInternal (System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, System.Object state, System.Boolean preserveSyncCtx) [0x00000] in <00000000000000000000000000000000>:0
at System.Threading.ExecutionContext.Run (System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, System.Object state) [0x00000] in <00000000000000000000000000000000>:0
UnityEngine.Logger:LogException(Exception, Object)
UnityEngine.Debug:LogException(Exception)
Code: Select all
[MonoPInvokeCallback( typeof( Phidget22.Events.RFIDTagEventHandler ) )]
private static void OnTag( object sender, Phidget22.Events.RFIDTagEventArgs e )
{
...
}
Cheers,
Dirk