I need to enable\disable Oculus plug-in provider for different types of build. How can i do it in code to automate process? Can’t find anywhere information about it.
1 Like
That’s exactly what I also would like to do. Did you found the solution?
Regards!
Probably this gist might help.
public class SetLoadersClass(){
// Assign this, it should be in your settings folder.
private UnityEngine.XR.Management.XRGeneralSettings androidSettings = null;
public void LoadOculusPlugin()
{
PlayerSettings.Android.minSdkVersion = AndroidSdkVersions.AndroidApiLevel24;
androidSettings.InitManagerOnStart = true;
var loaderString = typeof(Unity.XR.Oculus.OculusLoader).FullName
UnityEditor.XR.Management.Metadata.XRPackageMetadataStore.AssignLoader(androidSettings.AssignedSettings, loaderString, BuildTargetGroup.Android);
EditorUtility.SetDirty(androidSettings);
}
}
This worked for me. I think UnityEditor.XR.Management.Metadata.XRPackageMetadataStore.ClearLoaders is a thing if you want to reverse it as well