google-ar / arcore-unity-extensions

Google ARCore Extensions and Geospatial Creator for Unity's AR Foundation
Other
347 stars 97 forks source link

Build fail in multi-platform (oculus VR/ mobile AR) project #99

Open ahmed-shariff opened 1 year ago

ahmed-shariff commented 1 year ago

This is a continuation of the post in the unity forums.

I am working on a project that targets both Oculus and Mobile AR with ARCore's geosocial functionality enabled. I have the project setup with both ARCore and Oculus installed in the XR management settings. My current process is to disable ARCore when building for the Oculus and vice versa. When I am building for Oculus, if I try build & run, the build fails with the following error:

Error building Player: ARCoreLoader is not enabled! To ensure Extensions SDK can work properly on Android Platform, navigate to 'Project Settings > XR Plug-in Management', switch to Android tab and check 'ARCore' as the Plug-in Provider.​

But I am able to build the apk when I use build, Though that error still happens. Digging into the arcore-unity-extensions package, they have a check to see if the ARCore loader is enabled in XRMangement https://github.com/google-ar/arcore-unity-extensions/blob/55208a5317c2402e55ed7f931c16288d6a2b7756/Editor/Scripts/Internal/AndroidSupportPreprocessBuild.cs#L66

From my understanding of how the build process works, the IPreprocessBuildWithReport in the project always gets called and it's not exactly possible to disable a package when building.

Is there any alternatives to how I can handle this situation where I have to manage different conflicting build processes? Or is it simply impossible to do? On the other-hand is it something that can be fixed in this repo? One solution is to change LogError to LogWarning, but I am not sure if that would break some other pipeline.

CamiloMGS commented 1 year ago

Hello, A bit late, are you using XRLoader, to enable and disable ARCoreExtentions and Oculus when needed?

ahmed-shariff commented 1 year ago

Yes I am. i.e., XRPackageMetadataStore.AssignLoader