Viveport SDK and Unity's IL2CPP Build Option

andyman404
New Arrival

Viveport SDK and Unity's IL2CPP Build Option

Has anyone had any success in getting the Viveport SDK for Unity to work with Unity's IL2CPP build option?

 

I'm trying to integrate the Viveport SDK with my game, but when I build with the IL2CPP option and try to run it, I see this exception which prevents the Viveport API from trying to initialize:

NotSupportedException: IL2CPP does not support marshaling delegates that point to instance methods to native code.
  at Viveport.Internal.Api.Init (Viveport.Internal.StatusCallback initCallback, System.String appId) [0x00000] in <00000000000000000000000000000000>:0

 

I don't get this issue when running within the editor, or if I run a build of game with the Mono build option - the SDK works fine for both of those. This issue only happens for IL2CPP, which is unfortunate, because the game has better performance when built with IL2CPP. I'm using Windows 10 Pro, 64-bit, Unity 2018.2.13f1, and Viveport SDK 1.7.10 (via the Unity package in the SDK).

 

My code is pretty much just the example code in the SDK docs (but with my own VIVEPORT_ID obviously).  This issue appears to be happening inside the internal API.Init method when it is trying to make the call to the DLL.

 

Does anyone have any solutions/ideas, or is the Viveport SDK for Unity simple not compatible with the IL2CPP build option? If not, then how do we request for the Viveport SDK for Unity to support IL2CPP?

 

@yakingkuo

Vive Staff

Re: Viveport SDK and Unity's IL2CPP Build Option

Hi @andyman404:

 

Please check below link. 
https://answers.unity.com/questions/1229036/callbacks-from-c-to-c-are-not-working-in-540f3.html

 

Hope it can help you to fix this issue. 

Chiranjeev
Visitor

Re: Viveport SDK and Unity's IL2CPP Build Option

Have you found a solution of it? i am stucked with the same problem

@yakingkuo 

Vive Staff

Re: Viveport SDK and Unity's IL2CPP Build Option

Hi Chiranjeev: 

 

Your issue can not be solved by the link? 
https://answers.unity.com/questions/1229036/callbacks-from-c-to-c-are-not-working-in-540f3.html

@Chiranjeev 

 

Regards. 

Yaking