Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Join us on Dec 8, 2022, between 7 am & 7 pm EST, in the DOTS Dev Blitz Day 2022 - Q&A forum, Discord, and Unity3D Subreddit to learn more about DOTS directly from the Unity Developers.
    Dismiss Notice
  3. Have a look at our Games Focus blog post series which will show what Unity is doing for all game developers – now, next year, and in the future.
    Dismiss Notice

Question XR Management with multiple Android XR Plugins

Discussion in 'VR' started by FyndNorway, Sep 17, 2021.

  1. FyndNorway

    FyndNorway

    Joined:
    Sep 4, 2018
    Posts:
    11
    Hi,

    TL;DR: How can I have multiple XR Plugins enabled when I build for android and run the same .apk on different headsets like Oculus and Pico?

    Context: We are working on a cross platform app for business use, and as such we are at the moment expanding to support more standalone headsets than the Quest. Right now we have a Pico Neo 2 and a Vive Focus 3 to test with.

    Both of these have XR Management plugins, but not OpenXR support (yet). The app runs on each headset when only the relevant plugin is enabled, but if there is another plugin active before it in the list, the program does not even open. I have done some testing with initializing XR after the app has started, and this works, which leads me to believe I can run the app, let it check which XRLoader can be successfully initialized, and then run that subprocess.

    I am not certain how to reach this goal, so while I keep trying I would be thankful for any guidance or pointers to helpful resources.
     
  2. FyndNorway

    FyndNorway

    Joined:
    Sep 4, 2018
    Posts:
    11
    While looking into this, it seems like I have found another incompatibility between devices. On the Vive Focus 3, the app will not run without the app name in the AndroidManifest set to
    android:name="com.htc.vr.unity.WVRUnityVRActivity"

    While Pico and Quest can run an app with the name
    android:name="com.unity3d.player.UnityPlayerActivity"

    Looks like I would need to find a way to somehow read the manifest differently if I wanted to only build one file.
     
  3. FyndNorway

    FyndNorway

    Joined:
    Sep 4, 2018
    Posts:
    11
    Looking at the logcat does not make me more hopeful (running on Pico with Oculus plugin enabled but not loaded)

    Exiting application:
    This .apk was built with the Oculus XR Plugin loader enabled, but is attempting to run on a non-Oculus device.
    To build for general Android devices, please disable the Oculus XR Plugin before building the Android player.
     
  4. joejo

    joejo

    Unity Technologies

    Joined:
    May 26, 2016
    Posts:
    958
    The only way I see around this is to use build scripts to modify the loader list and build out separate APKs for each platform. I am not sure of any other way around this especially with that last message you are seeing.
     
  5. FyndNorway

    FyndNorway

    Joined:
    Sep 4, 2018
    Posts:
    11
    Then we've reached the same conclusion. We are reworking our build pipeline shortly so we should be able to automate this. Thank you!
     
  6. Ikaro88

    Ikaro88

    Joined:
    Jun 6, 2016
    Posts:
    246
    Hi, I have a unity project with the plugin provider oculus enabled.
    If I try to install on a normal device I get the error:

    Code (CSharp):
    1. This .apk was built with the Oculus XR Plugin loader enabled, but is attempting to run on a non-Oculus device.
    2. To build for general Android devices, please disable the Oculus XR Plugin before building the Android player.
    If I disable the check, it work on a android device but NOT on oculus.


    BUT
    The precedent developed created an apk that works correctly on both oculus and a generic android device?

    How to archive this?