Search Unity

  1. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Question Resolving build fail triggered by ARCore unity extension when building for oculus

Discussion in 'AR' started by ahmedshariff, Oct 20, 2022.

  1. ahmedshariff

    ahmedshariff

    Joined:
    Feb 25, 2020
    Posts:
    9
    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 (See AndroidSupportPreprocessBuild.cs)

    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?

    Previously asked in: https://forum.unity.com/threads/res...y-extension-when-building-for-oculus.1350860/
     
  2. andyb-unity

    andyb-unity

    Unity Technologies

    Joined:
    Feb 10, 2022
    Posts:
    989
    This is great feedback-- please pass on to Google! Unity is not affiliated with the ARCore Extensions package
     
  3. ahmedshariff

    ahmedshariff

    Joined:
    Feb 25, 2020
    Posts:
    9
    Yep, created an issue on their end as well. I was wondering if there was something on Unity's end to manage this, such as suppressing some of the callbacks or excluding packages from builds?
     
  4. andyb-unity

    andyb-unity

    Unity Technologies

    Joined:
    Feb 10, 2022
    Posts:
    989
    Not that I know of. The only way to remove the package from the build would be to modify your project manifest and completely remove the package from your project, but then any of your code dependent on the package would fail to compile and the build would fail.

    Theoretically you could write your entire app using a version define so that it compiles whether or not ARCore Extensions is present, but this is not recommended. The better solution would be for Google to fix the issue and meanwhile to avoid the Build and Run button I think.
     
  5. ahmedshariff

    ahmedshariff

    Joined:
    Feb 25, 2020
    Posts:
    9
    I see, thank you.

    Out of sheer curiosity, would this be something unity is planning on supporting at some point?
     
  6. andyb-unity

    andyb-unity

    Unity Technologies

    Joined:
    Feb 10, 2022
    Posts:
    989
    I'm but a humble developer on the XR team, so I can't speak with authority about Unity at large. My guess is that we have no plans to support conditional removal of packages based on build target. The more general solution to this problem would be to use preprocessor directives, but you're in a difficult position because you don't control the offending code.
     
    ahmedshariff likes this.
  7. HECer

    HECer

    Joined:
    Mar 17, 2013
    Posts:
    46
    I have the same problem, using Oculus, Pico and ARCore SDKs, switching to build for every platform.
    The Problem is also, ARCore really requires to be enabled and i even don't know where this error message is coming from, to be able to deactivate it and to build for the Oculus or Pico Platform.
     
  8. ahmedshariff

    ahmedshariff

    Joined:
    Feb 25, 2020
    Posts:
    9