How to keep Oculus IAP working in build when exporting in IL2CPP ?
How to keep Oculus IAP (In-app Purchase) working in build when exporting in IL2CPP ? Oculus IAP is correclty working when exporting in Mono. But when export is switched from Mono to IL2CPP, Unity seems to Strip the Oculus IAP (assembly ?) code. Then the Oculus IAP is not working anymore in the VR app. Impossible to find any documentation about it. I have created a link.xml and tried to add some Oculus assembly / class (type) but nothing worked. What am i missing ? See below the link.xml file.
<linker>
<assembly fullname="netstandard" preserve="all"/>
<assembly fullname="Assembly-CSharp">
<namespace fullname="Oculus.Platform" preserve="all" />
<type fullname="Oculus.Platform.IAP" preserve="all" />
<type fullname="Oculus.Platform.Core" preserve="all" />
<type fullname="Oculus.Platform.CAPI" preserve="all" />
<type fullname="Oculus.Platform.Request" preserve="all" />
<type fullname="Oculus.Platform.Message" preserve="all" />
<namespace fullname="Oculus.Platform.Models" preserve="all" />
<type fullname="Oculus.Platform.Models.Purchase" preserve="all" />
<type fullname="Oculus.Platform.Models.PurchaseList" preserve="all" />
<type fullname="Oculus.Platform.Models.Error" preserve="all" />
</assembly>
<!-- Oculus VR -->
<assembly fullname="Oculus.VR" preserve="all" />
<assembly fullname="Oculus.VR.Editor" preserve="all" />
<assembly fullname="Oculus.VR.Scripts.Editor" preserve="all" />
<assembly fullname="ovrplatform_standalone" preserve="all" />
<!-- ======= -->
</linker>
Thanks in advance for your help !
Would there be a reason for that last checkbox to not appear in our options?
Answer by HediB · Nov 19, 2020 at 06:53 AM
Solved ! In fact it was easy but tricky... When we export in Mono, we are in ARMV7 (32 bits), but when we switch to IL2CPP, we should export in ARM64 (64bits). Even if we check the Unity PlayerSetting Target Architecture ARM64, we also need to NOT FORGUET specify it in Oculus Platform Edit Settgins. So, no need to add some assembly in link.xml for Oculus Platform to work. We need to go to : 1. Unity Menu : Oculus > Platform > Edit Settings 2. Unity Inspector : Unity Inspector : OculusPlatformSettings - Build Settings > Check "Enable ARM64 Support"
And it's done ! all you previous Oculus Platform services will work again as they did in Mono ! For information, when checking this checkbox, it automatically enable the libovrplatformloader located in Unity Project window : Oculus > Platform > Plugins > Android64 that was initially "disabled" ( libovrplatformloader.so.disabled became enabled -> libovrplatformloader.so ).
That is why when you switch from Mono to IL2CPP ARM64, the Oculus Platform is disabled, waiting for the checkbox to be checked in order to work on Android 64 bits.
Easy but tricky when you start your project in Mono 32 bits, you don't check this checkbox for the first time and forguet it after a while not using it.
So, Remember to Check "Enable ARM64 Support" in OculusPlatformSettings when you switch from Mono to IL2CPP ! :) It will save you days of searching why the it doesn't work, thinking it's code stripping / file link.xml without success, until you find this is just a simple (old friend) checkbox to enabled in ARM64 ahah !
Hope this could help you! ;)
Screenshots attached if needed