Search Unity

Question How can i exclude all OpenXR and XR Interaction Toolkit stuff from some builds ?

Discussion in 'VR' started by Deathtreak, Mar 7, 2023.

  1. Deathtreak

    Deathtreak

    Joined:
    Nov 19, 2017
    Posts:
    17
    Hi,

    I'm wondering, how can i exclude OpenXR and XR Interaction Toolkit stuff from a project.
    In my case, i would like to build my project with and without VR support, but i dont know how to easily isolate VR stuff.
    My fear is that, some VR stuff will be integrated in Android build for exemple, and i dont need it on Android, only on Windows PC.
    How can i achieve separation ? Do i only need to have some specific initialization scenes and prefabs depending on plateforms i want to build, and unity will do the job in it's side ?
     
  2. Tanya_Li

    Tanya_Li

    Unity Technologies

    Joined:
    Jun 29, 2020
    Posts:
    105
    Hey,

    For OpenXR provider, you can simply uncheck / unselect it in the XR Plugin management UI for the platforms(e.g. Android if you don't need it). Then openxr package won't be included in the build.
     
  3. Deathtreak

    Deathtreak

    Joined:
    Nov 19, 2017
    Posts:
    17
    Hello again,

    Sorry for the delay, i didn't had time to test out.
    I made two build, one with OpenXR ticked in XR Plugin Management and one with OpenXR not ticked in XR Plugin Management
    The build size is quite the same and in mybuild/mybuild_Data/Managed i have all dll and pdb related to XR in both build :/
    I also tried building with an empty scene, just in case, and there's still all XR dll and pdb packed in project build
    Could it be because i have the XR Interaction Toolkit in my project and it force Unity to export OpenXR dependencies in builds ?
     
  4. mrwaveydavey

    mrwaveydavey

    Joined:
    Jun 5, 2013
    Posts:
    1
    Not sure if this helps, but I ended up here looking for how to do this.

    Remove the 'XR Device Simulator' gameobject from your scene completely.
    Go to: Project settings -> XR Plug-in Management -> XR Interaction Toolkit
    Tick Use XR Device Simulator in scenes
    Tick Instantiate In Editor Only.

    This will then instantiate the device simulator only in Editor when you hit play, and for builds, it won't exist :)
    It's prob still included in your build if you have the gameobject in your scene but have it deactivated. It's still in the project. This method, it's instantiated runtime, so not included in the build at all.