Fireproof Posted July 16, 2020 Share Posted July 16, 2020 I've found that if you try to use the GoToStore function in Unity with IL2CPP, then in a build it will fail with this: NotSupportedException: IL2CPP does not support marshaling delegates that point to instance methods to native code. at Viveport.Deeplink.GoToStore (Viveport.StatusCallback2 callback, System.String viveportId) [0x00000] in <00000000000000000000000000000000>:0 If you attempt to build the DeepLink demo that ships with the SDK, you get the same error. I put some code together which avoids using the official C# wrapper, and calls into the dll direct. Here it is, in case anyone else has the same problem in future: Disclaimer! While I can confirm that this doesn't report errors and does open Viveport, I don't know if it actually opens the correct app since ours isn't listed yet. [UnmanagedFunctionPointer(CallingConvention.Cdecl)] private delegate void Callback2(int result, [MarshalAs(UnmanagedType.LPStr)] string message); [DllImport("viveport_api64", EntryPoint = "IViveportDeeplink_GoToStore", CharSet = CharSet.Ansi, CallingConvention = CallingConvention.Cdecl)] private static extern void GoToStore(Callback2 callback, string appId); [AOT.MonoPInvokeCallback(typeof(Callback2))] static void GotoStoreHandlerMarhsalled(int result, [MarshalAs(UnmanagedType.LPStr)] string message) { Debug.Log($"Handled! {result.ToString()}, {message}"); } public override void GoToStorePage() { GoToStore(GoToStoreHandler, "APP_ID_HERE"); } This is basically the same problem that was reported two years ago here, so it's a shame it hasn't been fixed yet! https://forum.vive.com/topic/4538-viveport-sdk-and-unitys-il2cpp-build-option/?tab=comments#comment-4545 Link to comment Share on other sites More sharing options...
Corvus Posted July 16, 2020 Share Posted July 16, 2020 @Fireproof Thanks for re-reporting this. Can you let me know what version of Unity you're using? Link to comment Share on other sites More sharing options...
Fireproof Posted July 17, 2020 Author Share Posted July 17, 2020 @Corvus Thanks for the response! We're using 2018.4.14f1. Link to comment Share on other sites More sharing options...
Corvus Posted August 12, 2020 Share Posted August 12, 2020 @Fireproof Viveport SDK update v1.7.18 is now available that includes a hotfix for il2cpp errors. Let us know if this resolves your issue, specifically to ensure proper support for your Unity version. https://developer.vive.com/resources/knowledgebase/viveport-sdk-download/ Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now