@@ -470,6 +470,17 @@ private OVRProjectConfig oculusProjectConfig
470470
471471 protected override BuildTargetGroup requirdPlatform { get { return BuildTargetGroup . Android ; } }
472472
473+ private static bool editorGraphicsJobs
474+ {
475+ #if UNITY_5_4_OR_NEWER
476+ get { return PlayerSettings . graphicsJobs ; }
477+ set { PlayerSettings . graphicsJobs = value ; }
478+ #else
479+ get { return false ; }
480+ set { }
481+ #endif
482+ }
483+
473484 private string defaultAndroidManifestPath
474485 {
475486 get
@@ -491,84 +502,73 @@ public override bool canSupport
491502 {
492503 get
493504 {
505+ if ( activeBuildTargetGroup != requirdPlatform ) { return false ; }
494506#if UNITY_2019_3_OR_NEWER
495- return activeBuildTargetGroup == requirdPlatform && PackageManagerHelper . IsPackageInList ( OCULUS_XR_PACKAGE_NAME ) ;
507+ if ( ! PackageManagerHelper . IsPackageInList ( OCULUS_XR_PACKAGE_NAME ) ) { return false ; }
508+ if ( PackageManagerHelper . IsPackageInList ( WAVE_XR_PACKAGE_NAME ) ) { return false ; }
509+ if ( PackageManagerHelper . IsPackageInList ( OPENXR_PLUGIN_PACKAGE_NAME ) ) { return false ; }
496510#elif UNITY_2018_1_OR_NEWER
497- return activeBuildTargetGroup == requirdPlatform && ( PackageManagerHelper . IsPackageInList ( OCULUS_ANDROID_PACKAGE_NAME ) || PackageManagerHelper . IsPackageInList ( OCULUS_XR_PACKAGE_NAME ) ) ;
511+ if ( ! PackageManagerHelper . IsPackageInList ( OCULUS_ANDROID_PACKAGE_NAME ) && ! PackageManagerHelper . IsPackageInList ( OCULUS_XR_PACKAGE_NAME ) ) { return false ; }
498512#elif UNITY_5_6_OR_NEWER
499- return activeBuildTargetGroup == requirdPlatform && VRModule . isOculusVRPluginDetected ;
500- #else
501- return false ;
513+ if ( ! VRModule . isOculusVRPluginDetected ) { return false ; }
502514#endif
515+ return true ;
503516 }
504517 }
505518
506519 public override bool support
507520 {
508- #if UNITY_5_6_OR_NEWER
509521 get
510522 {
511523 if ( ! canSupport ) { return false ; }
512524 if ( PlayerSettings . Android . minSdkVersion < MIN_SUPPORTED_ANDROID_SDK_VERSION ) { return false ; }
513- if ( PlayerSettings . graphicsJobs ) { return false ; }
514525 if ( ( PlayerSettings . colorSpace == ColorSpace . Linear || PlayerSettings . gpuSkinning ) && ! GraphicsAPIContainsOnly ( BuildTarget . Android , GraphicsDeviceType . OpenGLES3 ) ) { return false ; }
515-
526+ if ( editorGraphicsJobs ) { return false ; }
516527#if UNITY_2019_3_OR_NEWER
517- bool supportOculusXR = ( VIUSettings . activateOculusVRModule || VIUSettings . activateUnityXRModule ) && XRPluginManagementUtils . IsXRLoaderEnabled ( OculusVRModule . OCULUS_XR_LOADER_NAME , requirdPlatform ) ;
518- bool supportOpenXR = VIUSettings . activateUnityXRModule && XRPluginManagementUtils . IsXRLoaderEnabled ( UnityXRModule . OPENXR_LOADER_NAME , requirdPlatform ) ;
519-
520- return canSupport && ( supportOculusXR || supportOpenXR ) ;
528+ if ( ! VIUSettings . activateOculusVRModule && ! VIUSettings . activateUnityXRModule ) { return false ; }
529+ if ( ! XRPluginManagementUtils . IsXRLoaderEnabled ( OculusVRModule . OCULUS_XR_LOADER_NAME , requirdPlatform ) ) { return false ; }
521530#else
522- if ( ! VIUSettings . activateOculusVRModule ) { return false ; }
531+ if ( ! VIUSettings . activateOculusVRModule && ! VIUSettings . activateUnityNativeVRModule ) { return false ; }
523532 if ( ! OculusSDK . enabled ) { return false ; }
524-
525- return true ;
526533#endif
534+ return true ;
527535 }
528536 set
529537 {
530- if ( support == value ) { return ; }
531-
532538 if ( value )
533539 {
534- supportWaveVR = false ;
535- supportDaydream = false ;
536-
537540 if ( PlayerSettings . Android . minSdkVersion < MIN_SUPPORTED_ANDROID_SDK_VERSION )
538541 {
539542 PlayerSettings . Android . minSdkVersion = MIN_SUPPORTED_ANDROID_SDK_VERSION ;
540543 }
541544
542- PlayerSettings . graphicsJobs = false ;
543-
544545 if ( PlayerSettings . colorSpace == ColorSpace . Linear || PlayerSettings . gpuSkinning )
545546 {
546547 SetGraphicsAPI ( BuildTarget . Android , GraphicsDeviceType . OpenGLES3 ) ;
547548 }
548- }
549549
550- VIUSettings . activateOculusVRModule = value ;
550+ editorGraphicsJobs = false ;
551+ VIUSettings . activateOculusVRModule = true ;
552+ VIUSettings . activateUnityXRModule = true ;
553+
551554#if UNITY_2019_3_OR_NEWER
552- if ( PackageManagerHelper . IsPackageInList ( OPENXR_PLUGIN_PACKAGE_NAME ) )
553- {
554- XRPluginManagementUtils . SetXRLoaderEnabled ( UnityXRModule . OPENXR_LOADER_CLASS_NAME , requirdPlatform , value ) ;
555+ VRSDKSettings . vrEnabled = false ;
556+ XRPluginManagementUtils . SetXRLoaderEnabled ( OculusVRModule . OCULUS_XR_LOADER_CLASS_NAME , requirdPlatform , true ) ;
557+ #else
558+ OculusSDK . enabled = true ;
559+ VIUSettings . activateUnityNativeVRModule = true ;
560+ #endif
555561 }
556- else if ( PackageManagerHelper . IsPackageInList ( OCULUS_XR_PACKAGE_NAME ) )
562+ else
557563 {
558- XRPluginManagementUtils . SetXRLoaderEnabled ( OculusVRModule . OCULUS_XR_LOADER_CLASS_NAME , requirdPlatform , value ) ;
559- }
560-
561- OculusSDK . enabled = value && ! PackageManagerHelper . IsPackageInList ( OCULUS_XR_PACKAGE_NAME ) ;
562- VIUSettings . activateUnityXRModule = XRPluginManagementUtils . IsAnyXRLoaderEnabled ( requirdPlatform ) ;
564+ VIUSettings . activateOculusVRModule = false ;
565+ #if UNITY_2019_3_OR_NEWER
566+ XRPluginManagementUtils . SetXRLoaderEnabled ( OculusVRModule . OCULUS_XR_LOADER_CLASS_NAME , requirdPlatform , false ) ;
563567#else
564- OculusSDK . enabled = value ;
565- VIUSettings . activateUnityNativeVRModule = value ;
568+ OculusSDK . enabled = false ;
566569#endif
570+ }
567571 }
568- #else
569- get { return false ; }
570- set { }
571- #endif
572572 }
573573
574574 public int callbackOrder { get { return 0 ; } }
@@ -579,8 +579,12 @@ public override void OnPreferenceGUI()
579579 if ( canSupport )
580580 {
581581 var wasSupported = support ;
582- support = m_foldouter . ShowFoldoutButtonOnToggleEnabled ( new GUIContent ( title , "Oculus Go, Oculus Quest" ) , wasSupported ) ;
583- s_symbolChanged |= wasSupported != support ;
582+ var shouldSupport = m_foldouter . ShowFoldoutButtonWithEnabledToggle ( new GUIContent ( title , "Oculus Go, Oculus Quest" ) , wasSupported ) ;
583+ if ( wasSupported != shouldSupport )
584+ {
585+ support = shouldSupport ;
586+ s_symbolChanged = true ;
587+ }
584588 }
585589 else
586590 {
@@ -590,28 +594,64 @@ public override void OnPreferenceGUI()
590594 if ( activeBuildTargetGroup != requirdPlatform )
591595 {
592596 GUI . enabled = false ;
593- ShowToggle ( new GUIContent ( title , "Android platform required.") , false , GUILayout . Width ( 150f ) ) ;
597+ ShowToggle ( new GUIContent ( title , requirdPlatform + " platform required.") , false , GUILayout . Width ( 150f ) ) ;
594598 GUI . enabled = true ;
595599 GUILayout . FlexibleSpace ( ) ;
596- ShowSwitchPlatformButton ( BuildTargetGroup . Android , BuildTarget . Android ) ;
600+ ShowSwitchPlatformButton ( requirdPlatform , BuildTarget . Android ) ;
597601 }
598- #if UNITY_2020_2_OR_NEWER && FALSE // openxr not fully supported yet
599- else if ( ! PackageManagerHelper . IsPackageInList ( OPENXR_PLUGIN_PACKAGE_NAME ) )
602+ #if UNITY_2019_3_OR_NEWER
603+ else if ( ! PackageManagerHelper . IsPackageInList ( OCULUS_XR_PACKAGE_NAME ) )
600604 {
601605 GUI . enabled = false ;
602- ShowToggle ( new GUIContent ( title , "OpenXR Plugin package required." ) , false , GUILayout . Width ( 230f ) ) ;
606+ ShowToggle ( new GUIContent ( title , "Oculus XR Plugin package required." ) , false , GUILayout . Width ( 230f ) ) ;
603607 GUI . enabled = true ;
604608 GUILayout . FlexibleSpace ( ) ;
605- ShowAddPackageButton ( "OpenXR Plugin" , OPENXR_PLUGIN_PACKAGE_NAME ) ;
609+ ShowAddPackageButton ( "Oculus XR Plugin" , OCULUS_XR_PACKAGE_NAME ) ;
606610 }
607- #elif UNITY_2019_3_OR_NEWER
608- else if ( ! PackageManagerHelper . IsPackageInList ( OCULUS_XR_PACKAGE_NAME ) )
611+ else if ( PackageManagerHelper . IsPackageInList ( WAVE_XR_PACKAGE_NAME ) )
609612 {
610613 GUI . enabled = false ;
611- ShowToggle ( new GUIContent ( title , "Oculus XR Plugin package required ." ) , false , GUILayout . Width ( 230f ) ) ;
614+ ShowToggle ( new GUIContent ( title , "Conflict package found ." ) , false , GUILayout . Width ( 230f ) ) ;
612615 GUI . enabled = true ;
613616 GUILayout . FlexibleSpace ( ) ;
614- ShowAddPackageButton ( "Oculus XR Plugin" , OCULUS_XR_PACKAGE_NAME ) ;
617+
618+ var btnLabel = new GUIContent ( ) ;
619+ string tmPkgName ;
620+ if ( PackageManagerHelper . IsPackageInList ( WAVE_XR_PACKAGE_ESSENCE_NAME ) )
621+ {
622+ btnLabel . text = "Remove Wave XR Plugin - Essence" ;
623+ btnLabel . tooltip = "Conflict package found. Remove " + WAVE_XR_PACKAGE_ESSENCE_NAME + " from Package Manager" ;
624+ tmPkgName = WAVE_XR_PACKAGE_ESSENCE_NAME ;
625+ }
626+ else if ( PackageManagerHelper . IsPackageInList ( WAVE_XR_PACKAGE_NATIVE_NAME ) )
627+ {
628+ btnLabel . text = "Remove Wave XR Plugin - Native" ;
629+ btnLabel . tooltip = "Conflict package found. Remove " + WAVE_XR_PACKAGE_NATIVE_NAME + " from Package Manager" ;
630+ tmPkgName = WAVE_XR_PACKAGE_NATIVE_NAME ;
631+ }
632+ else
633+ {
634+ btnLabel . text = "Remove Wave XR Plugin" ;
635+ btnLabel . tooltip = "Conflict package found. Remove " + WAVE_XR_PACKAGE_NAME + " from Package Manager" ;
636+ tmPkgName = WAVE_XR_PACKAGE_NAME ;
637+ }
638+
639+ if ( GUILayout . Button ( btnLabel , GUILayout . ExpandWidth ( false ) ) )
640+ {
641+ PackageManagerHelper . RemovePackage ( tmPkgName ) ;
642+ }
643+ }
644+ else if ( PackageManagerHelper . IsPackageInList ( OPENXR_PLUGIN_PACKAGE_NAME ) )
645+ {
646+ GUI . enabled = false ;
647+ ShowToggle ( new GUIContent ( title , "Conflict package found." ) , false , GUILayout . Width ( 230f ) ) ;
648+ GUI . enabled = true ;
649+ GUILayout . FlexibleSpace ( ) ;
650+
651+ if ( GUILayout . Button ( new GUIContent ( "Remove OpenXR Plugin" , "Conflict package found. Remove " + OPENXR_PLUGIN_PACKAGE_NAME + " from Package Manager" ) , GUILayout . ExpandWidth ( false ) ) )
652+ {
653+ PackageManagerHelper . RemovePackage ( OPENXR_PLUGIN_PACKAGE_NAME ) ;
654+ }
615655 }
616656#elif UNITY_2018_2_OR_NEWER
617657 else if ( ! PackageManagerHelper . IsPackageInList ( OCULUS_ANDROID_PACKAGE_NAME ) )
@@ -641,12 +681,12 @@ public override void OnPreferenceGUI()
641681 {
642682 EditorGUI . indentLevel += 2 ;
643683
644- #if VIU_OCULUSVR
684+ #if VIU_OCULUSVR_20_0_OR_NEWER
645685 // Hand tracking support
646686 EditorGUILayout . BeginHorizontal ( ) ;
647687 OVRProjectConfig . HandTrackingSupport originalHandTrackingSupport = oculusProjectConfig . handTrackingSupport ;
648- oculusProjectConfig . handTrackingSupport = ( OVRProjectConfig . HandTrackingSupport ) EditorGUILayout . EnumPopup ( "Hand Tracking Support: " , originalHandTrackingSupport ) ;
649-
688+ oculusProjectConfig . handTrackingSupport = ( OVRProjectConfig . HandTrackingSupport ) EditorGUILayout . EnumPopup ( "Hand Tracking Support: " , originalHandTrackingSupport ) ;
689+
650690 if ( oculusProjectConfig . handTrackingSupport != originalHandTrackingSupport )
651691 {
652692 EditorUtility . SetDirty ( oculusProjectConfig ) ;
0 commit comments