Search Unity

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:
    18
    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:
    18
    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:
    18
    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:
    18
    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:
    300
    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?
     
  7. baggyg

    baggyg

    Joined:
    Nov 21, 2013
    Posts:
    29
    I also gave this a try. I could get around the Oculus Plugin check (and actually prevent that from being loaded) and for the Pico loader to be initialized but on Pico it just hung and constantly was getting an unknown response to the SDK query (suggesting the Oculus loader was still being used somewhere).

    I feel it is very close, but missing something vital. It would be great if it was possible to adjust the loader list before anything else happens in Unity (Graphics systems, etc). Pretty easy to amend looking at SystemInfo.deviceModel.