I have a project i'm working with a group on that is networked between an Oculus and Mobile app with Photon networking. To prevent errors the mobile version needs the oculus package and the VR player. With the Oculus folder/package in the project when i try to build the mobile app it forces it to build to VR. I have checked the XR setting and VR support is set to inactive but it still build it in VR. Was wondering if anyone knew if the Oculus package forces a VR build somewhere even with VR supported unchecked on both android and the pc XR settings
Did you found something that worked for you? I have sort of the same problem. https://forum.unity.com/threads/oculus-ar-and-holelens-in-the-same-unity-project.1199380/
Depends how your scene and code is setup. If you don't check 'initialize XR on startup' or disable the oculus package it doesn't go into VR. Then maybe use 2 different scenes for input and load them next to the main game?
We are using the following to switch between VR and AR. You can also just remove/add the VR plugin before building. (IPreprocessBuildWithReport) Code (CSharp): private void SetXRPlugins(string[] addPlugins, string[] removePlugins, UnityEditor.BuildTargetGroup buildTarget) { var xrSettings = XRGeneralSettingsPerBuildTarget.XRGeneralSettingsForBuildTarget(buildTarget); if(xrSettings == null) { XRGeneralSettingsPerBuildTarget buildTargetSettings = null; EditorBuildSettings.TryGetConfigObject(XRGeneralSettings.k_SettingsKey, out buildTargetSettings); xrSettings = buildTargetSettings.SettingsForBuildTarget(BuildTargetGroup.Android); } xrSettings.InitManagerOnStart = true; foreach(var addPlugin in addPlugins) { if(!XRPackageMetadataStore.AssignLoader(xrSettings.Manager, addPlugin, buildTarget)) { Debug.LogWarning("PLUGIN NOT ASSIGNED!: " + addPlugin); } } foreach(var removePlugin in removePlugins) { if(!XRPackageMetadataStore.RemoveLoader(xrSettings.Manager, removePlugin, buildTarget)) { Debug.LogWarning("PLUGIN NOT REMOVED!: " + removePlugin); } } EditorUtility.SetDirty(xrSettings); } //Switch to Oculus: addPlugins = new string[] { typeof(global::Unity.XR.Oculus.OculusLoader).FullName }; removePlugins = new string[] { typeof(UnityEngine.XR.ARCore.ARCoreLoader).FullName }; //Switch to AR: removePlugins = new string[] { typeof(global::Unity.XR.Oculus.OculusLoader).FullName }; addPlugins = new string[] { typeof(UnityEngine.XR.ARCore.ARCoreLoader).FullName }; But we still have to remove the Oculus folder by hand (and restart Unity) before building, else the build will fail at start-up. EDIT: Can confirm that running a Pre-build shell script on Unity Cloud Build fixed my problem. For other people who have the same issue: UnityCloudBuildScript.sh Code (CSharp): #!/bin/bash rm -r Assets/Oculus Should do the trick