Skip to content

Commit 5d75c2a

Browse files
committed
GVR Unity SDK v1.0.1
1 parent d514121 commit 5d75c2a

File tree

4 files changed

+17
-5
lines changed

4 files changed

+17
-5
lines changed

GoogleVR/Scripts/GvrSettings.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
/// </summary>
1919

2020
// This class is defined only for versions of Unity with the GVR native integration.
21-
#if UNITY_HAS_GOOGLEVR && UNITY_ANDROID
21+
#if UNITY_HAS_GOOGLEVR && (UNITY_ANDROID || UNITY_EDITOR)
2222
using UnityEngine;
2323
using UnityEngine.VR;
2424
using System;
@@ -153,4 +153,4 @@ private static void SetSustainedPerformanceMode(bool enabled) {
153153
private static extern int gvr_user_prefs_get_controller_handedness(IntPtr gvrUserPrefsPtr);
154154

155155
}
156-
#endif // UNITY_HAS_GOOGLEVR && UNITY_ANDROID
156+
#endif // UNITY_HAS_GOOGLEVR && (UNITY_ANDROID || UNITY_EDITOR)

GoogleVR/Scripts/GvrViewer.cs

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -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
}

GoogleVR/Scripts/Utilities/GvrFPS.cs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,9 @@ void Start() {
4242
}
4343

4444
void LateUpdate() {
45-
float interp = Time.deltaTime / (0.5f + Time.deltaTime);
46-
float currentFPS = 1.0f / Time.deltaTime;
45+
float deltaTime = Time.unscaledDeltaTime;
46+
float interp = deltaTime / (0.5f + deltaTime);
47+
float currentFPS = 1.0f / deltaTime;
4748
fps = Mathf.Lerp(fps, currentFPS, interp);
4849
float msf = MS_PER_SEC / fps;
4950
textField.text = string.Format(DISPLAY_TEXT_FORMAT,

GoogleVRForUnity.unitypackage

36.9 KB
Binary file not shown.

0 commit comments

Comments
 (0)