@@ -86,16 +86,23 @@ public static StereoController Controller {
8686
8787 /// Determine whether the scene renders in stereo or mono.
8888 /// Supported only for versions of Unity *without* the GVR integration.
89+ /// VRModeEnabled will be a no-op for versions of Unity with the GVR integration.
8990 /// _True_ means to render in stereo, and _false_ means to render in mono.
9091 public bool VRModeEnabled {
9192 get {
93+ #if ! UNITY_HAS_GOOGLEVR || UNITY_EDITOR
9294 return vrModeEnabled ;
95+ #else
96+ return UnityEngine . VR . VRSettings . enabled ;
97+ #endif // !UNITY_HAS_GOOGLEVR || UNITY_EDITOR
9398 }
9499 set {
100+ #if ! UNITY_HAS_GOOGLEVR || UNITY_EDITOR
95101 if ( value != vrModeEnabled && device != null ) {
96102 device . SetVRModeEnabled ( value ) ;
97103 }
98104 vrModeEnabled = value ;
105+ #endif // !UNITY_HAS_GOOGLEVR || UNITY_EDITOR
99106 }
100107 }
101108 [ SerializeField ]
@@ -212,7 +219,7 @@ public float StereoScreenScale {
212219 public RenderTexture StereoScreen {
213220 get {
214221 // Don't need it except for distortion correction.
215- if ( ! distortionCorrectionEnabled || ! vrModeEnabled ) {
222+ if ( ! distortionCorrectionEnabled || ! VRModeEnabled ) {
216223 return null ;
217224 }
218225 if ( stereoScreen == null ) {
@@ -346,7 +353,9 @@ private void InitDevice() {
346353
347354 device . SetNeckModelScale ( neckModelScale ) ;
348355
356+ #if ! UNITY_HAS_GOOGLEVR || UNITY_EDITOR
349357 device . SetVRModeEnabled ( vrModeEnabled ) ;
358+ #endif // !UNITY_HAS_GOOGLEVR || UNITY_EDITOR
350359
351360 device . UpdateScreenData ( ) ;
352361 }
@@ -522,7 +531,9 @@ void OnApplicationQuit() {
522531 }
523532
524533 void OnDestroy ( ) {
534+ #if ! UNITY_HAS_GOOGLEVR || UNITY_EDITOR
525535 VRModeEnabled = false ;
536+ #endif // !UNITY_HAS_GOOGLEVR || UNITY_EDITOR
526537 if ( device != null ) {
527538 device . Destroy ( ) ;
528539 }
0 commit comments