Last active
January 28, 2025 15:21
-
-
Save korinVR/a8c185cbbca6467b56c33428c68efa80 to your computer and use it in GitHub Desktop.
Revisions
-
korinVR revised this gist
Aug 18, 2021 . 1 changed file with 10 additions and 8 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -6,22 +6,16 @@ namespace FrameSynthesis.XR { // ref. https://docs.unity3d.com/Packages/com.unity.xr.management@4.1/manual/EndUser.html public static class XRPluginManagementSettings { public enum Plugin { OpenXR, Oculus, OpenVR } public static void EnablePlugin(BuildTargetGroup buildTargetGroup, Plugin plugin) { var buildTargetSettings = XRGeneralSettingsPerBuildTarget.XRGeneralSettingsForBuildTarget(buildTargetGroup); @@ -43,5 +37,13 @@ public static void DisablePlugin(BuildTargetGroup buildTargetGroup, Plugin plugi Debug.Log($"XR Plug-in Management: Disabled {plugin} plugin on {buildTargetGroup}"); } } static string GetLoaderName(Plugin plugin) => plugin switch { Plugin.OpenXR => "UnityEngine.XR.OpenXR.OpenXRLoader", Plugin.Oculus => "Unity.XR.Oculus.OculusLoader", Plugin.OpenVR => "Unity.XR.OpenVR.OpenVRLoader", _ => throw new NotImplementedException() }; } } -
korinVR revised this gist
Jan 13, 2021 . 1 changed file with 5 additions and 11 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -15,18 +15,12 @@ public enum Plugin OpenVR } static string GetLoaderName(Plugin plugin) => plugin switch { Plugin.Oculus => "Unity.XR.Oculus.OculusLoader", Plugin.OpenVR => "Unity.XR.OpenVR.OpenVRLoader", _ => throw new NotImplementedException() }; public static void EnablePlugin(BuildTargetGroup buildTargetGroup, Plugin plugin) { -
korinVR revised this gist
Jan 13, 2021 . 1 changed file with 2 additions and 2 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -4,7 +4,7 @@ using UnityEditor.XR.Management.Metadata; using UnityEngine; namespace FrameSynthesis.XR { // ref. https://docs.unity3d.com/Packages/[email protected]/manual/EndUser.html public static class XRPluginManagementSettings @@ -15,7 +15,7 @@ public enum Plugin OpenVR } static string GetLoaderName(Plugin plugin) { switch (plugin) { -
korinVR revised this gist
Sep 14, 2020 . No changes.There are no files selected for viewing
-
korinVR created this gist
Sep 14, 2020 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,53 @@ using System; using UnityEditor; using UnityEditor.XR.Management; using UnityEditor.XR.Management.Metadata; using UnityEngine; namespace FrameSynthesis { // ref. https://docs.unity3d.com/Packages/[email protected]/manual/EndUser.html public static class XRPluginManagementSettings { public enum Plugin { Oculus, OpenVR } public static string GetLoaderName(Plugin plugin) { switch (plugin) { case Plugin.Oculus: return "Unity.XR.Oculus.OculusLoader"; case Plugin.OpenVR: return "Unity.XR.OpenVR.OpenVRLoader"; default: throw new NotImplementedException(); } } public static void EnablePlugin(BuildTargetGroup buildTargetGroup, Plugin plugin) { var buildTargetSettings = XRGeneralSettingsPerBuildTarget.XRGeneralSettingsForBuildTarget(buildTargetGroup); var pluginsSettings = buildTargetSettings.AssignedSettings; var success = XRPackageMetadataStore.AssignLoader(pluginsSettings, GetLoaderName(plugin), buildTargetGroup); if (success) { Debug.Log($"XR Plug-in Management: Enabled {plugin} plugin on {buildTargetGroup}"); } } public static void DisablePlugin(BuildTargetGroup buildTargetGroup, Plugin plugin) { var buildTargetSettings = XRGeneralSettingsPerBuildTarget.XRGeneralSettingsForBuildTarget(buildTargetGroup); var pluginsSettings = buildTargetSettings.AssignedSettings; var success = XRPackageMetadataStore.RemoveLoader(pluginsSettings, GetLoaderName(plugin), buildTargetGroup); if (success) { Debug.Log($"XR Plug-in Management: Disabled {plugin} plugin on {buildTargetGroup}"); } } } }