@@ -387,14 +387,15 @@ public override bool canSupport
387387 {
388388 get
389389 {
390+ if ( activeBuildTargetGroup != requirdPlatform ) { return false ; }
390391#if UNITY_2019_3_OR_NEWER
391- return activeBuildTargetGroup == BuildTargetGroup . Standalone && ( PackageManagerHelper . IsPackageInList ( OPENXR_PLUGIN_PACKAGE_NAME ) || PackageManagerHelper . IsPackageInList ( OPENVR_XR_PACKAGE_NAME ) || PackageManagerHelper . IsPackageInList ( OPENVR_XR_PACKAGE_NAME_OLD ) ) ;
392+ return PackageManagerHelper . IsPackageInList ( OPENVR_XR_PACKAGE_NAME ) || PackageManagerHelper . IsPackageInList ( OPENVR_XR_PACKAGE_NAME_OLD ) ;
392393#elif UNITY_2018_1_OR_NEWER
393- return activeBuildTargetGroup == BuildTargetGroup . Standalone && ( ( PackageManagerHelper . IsPackageInList ( OPENVR_XR_PACKAGE_NAME ) || PackageManagerHelper . IsPackageInList ( OPENVR_XR_PACKAGE_NAME_OLD ) ) || PackageManagerHelper . IsPackageInList ( OPENVR_PACKAGE_NAME ) ) ;
394+ return PackageManagerHelper . IsPackageInList ( OPENVR_XR_PACKAGE_NAME ) || PackageManagerHelper . IsPackageInList ( OPENVR_XR_PACKAGE_NAME_OLD ) || PackageManagerHelper . IsPackageInList ( OPENVR_PACKAGE_NAME ) ;
394395#elif UNITY_5_5_OR_NEWER
395- return activeBuildTargetGroup == BuildTargetGroup . Standalone ;
396+ return true ;
396397#else
397- return activeBuildTargetGroup == BuildTargetGroup . Standalone && VRModule . isSteamVRPluginDetected ;
398+ return VRModule . isSteamVRPluginDetected ;
398399#endif
399400 }
400401 }
@@ -403,17 +404,15 @@ public override bool support
403404 {
404405 get
405406 {
407+ if ( ! canSupport ) { return false ; }
406408#if UNITY_2019_3_OR_NEWER
407- bool supportOpenVRXR = ( VIUSettings . activateSteamVRModule || VIUSettings . activateUnityXRModule ) && XRPluginManagementUtils . IsXRLoaderEnabled ( SteamVRModule . OPENVR_XR_LOADER_NAME , requirdPlatform ) ;
408- bool supportOpenXR = VIUSettings . activateUnityXRModule && XRPluginManagementUtils . IsXRLoaderEnabled ( UnityXRModule . OPENXR_LOADER_NAME , requirdPlatform ) ;
409-
410- return canSupport && ( supportOpenVRXR || supportOpenXR ) ;
409+ return ( VIUSettings . activateSteamVRModule || VIUSettings . activateUnityXRModule ) && XRPluginManagementUtils . IsXRLoaderEnabled ( SteamVRModule . OPENVR_XR_LOADER_NAME , requirdPlatform ) ;
411410#elif UNITY_5_5_OR_NEWER
412- return canSupport && ( VIUSettings . activateSteamVRModule || VIUSettings . activateUnityNativeVRModule ) && OpenVRSDK . enabled ;
411+ return ( VIUSettings . activateSteamVRModule || VIUSettings . activateUnityNativeVRModule ) && OpenVRSDK . enabled ;
413412#elif UNITY_5_4_OR_NEWER
414- return canSupport && VIUSettings . activateSteamVRModule && OpenVRSDK . enabled ;
413+ return VIUSettings . activateSteamVRModule && OpenVRSDK . enabled ;
415414#else
416- return canSupport && VIUSettings . activateSteamVRModule && ! virtualRealitySupported ;
415+ return VIUSettings . activateSteamVRModule && ! virtualRealitySupported ;
417416#endif
418417 }
419418 set
@@ -422,11 +421,7 @@ public override bool support
422421
423422 VIUSettings . activateSteamVRModule = value ;
424423#if UNITY_2019_3_OR_NEWER
425- if ( PackageManagerHelper . IsPackageInList ( OPENXR_PLUGIN_PACKAGE_NAME ) )
426- {
427- XRPluginManagementUtils . SetXRLoaderEnabled ( UnityXRModule . OPENXR_LOADER_CLASS_NAME , requirdPlatform , value ) ;
428- }
429- else if ( PackageManagerHelper . IsPackageInList ( OPENVR_XR_PACKAGE_NAME ) || PackageManagerHelper . IsPackageInList ( OPENVR_XR_PACKAGE_NAME_OLD ) )
424+ if ( PackageManagerHelper . IsPackageInList ( OPENVR_XR_PACKAGE_NAME ) || PackageManagerHelper . IsPackageInList ( OPENVR_XR_PACKAGE_NAME_OLD ) )
430425 {
431426 XRPluginManagementUtils . SetXRLoaderEnabled ( SteamVRModule . OPENVR_XR_LOADER_CLASS_NAME , requirdPlatform , value ) ;
432427 }
@@ -478,16 +473,7 @@ public override void OnPreferenceGUI()
478473 GUILayout . FlexibleSpace ( ) ;
479474 ShowSwitchPlatformButton ( BuildTargetGroup . Standalone , BuildTarget . StandaloneWindows64 ) ;
480475 }
481- #if UNITY_2020_2_OR_NEWER && FALSE // openxr not fully supported yet
482- else if ( ! PackageManagerHelper . IsPackageInList ( OPENXR_PLUGIN_PACKAGE_NAME ) )
483- {
484- GUI . enabled = false ;
485- ShowToggle ( new GUIContent ( title , "OpenXR Plugin ackage required." ) , false , GUILayout . Width ( 230f ) ) ;
486- GUI . enabled = true ;
487- GUILayout . FlexibleSpace ( ) ;
488- ShowAddPackageButton ( "OpenXR Plugin" , OPENXR_PLUGIN_PACKAGE_NAME ) ;
489- }
490- #elif UNITY_2019_3_OR_NEWER && FALSE // openvr xr plugin on Valve registry is obsolete
476+ #if UNITY_2019_3_OR_NEWER && FALSE // openvr xr plugin on Valve registry is obsolete
491477 else if ( ! PackageManagerHelper . IsPackageInList ( OPENVR_XR_PACKAGE_NAME ) )
492478 {
493479 GUI . enabled = false ;
0 commit comments