Skip to content
This repository has been archived by the owner on Nov 8, 2019. It is now read-only.

Commit

Permalink
GVR SDK for Unity v1.190.0
Browse files Browse the repository at this point in the history
  • Loading branch information
rusmaxham committed Jan 11, 2019
1 parent 8f0cdb5 commit 04a79a1
Show file tree
Hide file tree
Showing 170 changed files with 2,609 additions and 833 deletions.
38 changes: 28 additions & 10 deletions .github/ISSUE_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -1,19 +1,37 @@
Summary:
<!-- Use this issue tracker to file bugs and feature requests
related to the Google VR SDK for Unity.
For advice and general questions, please use the `google-cardboard` and
`daydream` tags on Stack Overflow:
- https://stackoverflow.com/questions/tagged/google-cardboard
- https://stackoverflow.com/questions/tagged/daydream
-->

Found using:
* Google VR SDK version:
* Unity version:
* Phone manufacturer, model, and O/S version:
* Viewer manufacturer & model:

Steps to reproduce the issue:
### SPECIFIC ISSUE ENCOUNTERED


### HARDWARE/SOFTWARE VERSIONS
- Unity:
- Google VR SDK for Unity:
- Device manufacturer, model, and O/S:
- Device fingerprint:
Use `adb shell getprop ro.build.fingerprint`
- Device display metrics:
Output of `adb shell dumpsys display | grep mBaseDisplayInfo`
- Google VR Services:
On Windows, use: `adb shell pm dump com.google.vr.vrcore | findstr /i "packages: versionName"`
On macOS, use: `adb shell pm dump com.google.vr.vrcore | egrep -i versionName\|packages:`
- Viewer manufacturer & model:
- Link to Unity project that reproduces the issue:


### STEPS TO REPRODUCE THE ISSUE
1.
1.
1.

Workarounds:

### WORKAROUNDS (IF ANY)

Additional comments:

### ADDITIONAL COMMENTS
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
//-----------------------------------------------------------------------
// <copyright file="DemoObjectController6DoF.cs" company="Google Inc.">
// Copyright 2018 Google Inc. All rights reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
Expand All @@ -11,6 +13,8 @@
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
// </copyright>
//-----------------------------------------------------------------------

namespace GoogleVR.Hello6DoFController
{
Expand Down
4 changes: 4 additions & 0 deletions Assets/GoogleVR/Beta/Scripts/GvrBeta.cs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
//-----------------------------------------------------------------------
// <copyright file="GvrBeta.cs" company="Google Inc.">
// Copyright 2018 Google Inc. All rights reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
Expand All @@ -11,6 +13,8 @@
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
// </copyright>
//-----------------------------------------------------------------------

/// Daydream Beta API. This API surface is for experimental purposes and may
/// change or be removed in any future release without forewarning.
Expand Down
6 changes: 5 additions & 1 deletion Assets/GoogleVR/Beta/Scripts/GvrBetaControllerVisualMulti.cs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
//-----------------------------------------------------------------------
// <copyright file="GvrBetaControllerVisualMulti.cs" company="Google Inc.">
// Copyright 2018 Google Inc. All rights reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
Expand All @@ -11,6 +13,8 @@
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
// </copyright>
//-----------------------------------------------------------------------

namespace GoogleVR.Beta
{
Expand Down Expand Up @@ -49,7 +53,7 @@ protected override VisualAssets GetVisualAssets()

int controllerVisualIndex = 0;
if (ControllerInputDevice != null &&
ControllerInputDevice.GetConfigurationType() ==
ControllerInputDevice.GetConfigurationType() ==
GvrBetaControllerInput.Configuration.Is6DoF)
{
controllerVisualIndex = 1;
Expand Down
4 changes: 4 additions & 0 deletions Assets/GoogleVR/Demos/Editor/DemoInputManagerEditor.cs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
//-----------------------------------------------------------------------
// <copyright file="DemoInputManagerEditor.cs" company="Google Inc.">
// Copyright 2016 Google Inc. All rights reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
Expand All @@ -11,6 +13,8 @@
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
// </copyright>
//-----------------------------------------------------------------------

namespace GoogleVR.Demos
{
Expand Down
26 changes: 14 additions & 12 deletions Assets/GoogleVR/Demos/Editor/PermissionsDemoBuildProcessor.cs
Original file line number Diff line number Diff line change
@@ -1,20 +1,22 @@
//-----------------------------------------------------------------------
// <copyright file="PermissionsDemoBuildProcessor.cs" company="Google Inc.">
// Copyright (C) 2016 Google Inc. All Rights Reserved.
// Copyright 2017 Google Inc. All rights reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
// Only invoke custom build processor when building for Android.
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
// </copyright>
//-----------------------------------------------------------------------

// Only invoke custom build processor when building for Android.
#if UNITY_ANDROID
namespace GoogleVR.Demos
{
Expand Down
4 changes: 4 additions & 0 deletions Assets/GoogleVR/Demos/Scenes/KeyboardDemo.unity
Original file line number Diff line number Diff line change
Expand Up @@ -1307,6 +1307,10 @@ Prefab:
propertyPath: m_RootOrder
value: 0
objectReference: {fileID: 0}
- target: {fileID: 11499020, guid: 8524bbe5e592a42dc9251484a73c9c7f, type: 2}
propertyPath: controllerPointers.Array.data[0]
value:
objectReference: {fileID: 328517437}
m_RemovedComponents: []
m_ParentPrefab: {fileID: 100100000, guid: 8524bbe5e592a42dc9251484a73c9c7f, type: 2}
m_IsPrefabParent: 0
6 changes: 5 additions & 1 deletion Assets/GoogleVR/Demos/Scenes/VideoDemo.unity
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ RenderSettings:
m_ReflectionIntensity: 1
m_CustomReflection: {fileID: 0}
m_Sun: {fileID: 0}
m_IndirectSpecularColor: {r: 0.4465934, g: 0.49642956, b: 0.5748249, a: 1}
m_IndirectSpecularColor: {r: 0.4465934, g: 0.49642956, b: 0.57482487, a: 1}
--- !u!157 &3
LightmapSettings:
m_ObjectHideFlags: 0
Expand Down Expand Up @@ -622,6 +622,10 @@ Prefab:
propertyPath: m_LocalPosition.z
value: 4
objectReference: {fileID: 0}
- target: {fileID: 11499020, guid: 8524bbe5e592a42dc9251484a73c9c7f, type: 2}
propertyPath: controllerPointers.Array.data[0]
value:
objectReference: {fileID: 817331498}
m_RemovedComponents: []
m_ParentPrefab: {fileID: 100100000, guid: 8524bbe5e592a42dc9251484a73c9c7f, type: 2}
m_IsPrefabParent: 0
Expand Down
113 changes: 58 additions & 55 deletions Assets/GoogleVR/Demos/Scripts/DemoInputManager.cs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
//-----------------------------------------------------------------------
// <copyright file="DemoInputManager.cs" company="Google Inc.">
// Copyright 2017 Google Inc. All rights reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
Expand All @@ -11,6 +13,8 @@
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
// </copyright>
//-----------------------------------------------------------------------

#if UNITY_ANDROID && !UNITY_EDITOR
#define RUNNING_ON_ANDROID_DEVICE
Expand All @@ -24,7 +28,6 @@ namespace GoogleVR.Demos

#if UNITY_2017_2_OR_NEWER
using UnityEngine.XR;

#else
using XRSettings = UnityEngine.VR.VRSettings;
#endif // UNITY_2017_2_OR_NEWER
Expand All @@ -34,17 +37,17 @@ public class DemoInputManager : MonoBehaviour
private const string MESSAGE_CANVAS_NAME = "MessageCanvas";
private const string MESSAGE_TEXT_NAME = "MessageText";
private const string LASER_GAMEOBJECT_NAME = "Laser";
private const string CONTROLLER_CONNECTING_MESSAGE = "Controller connecting...";
private const string CONTROLLER_DISCONNECTED_MESSAGE = "Controller disconnected";
private const string CONTROLLER_SCANNING_MESSAGE = "Controller scanning...";
private const string CONTROLLER_CONNECTING_MESSAGE = "Daydream controller connecting...";
private const string CONTROLLER_DISCONNECTED_MESSAGE = "Daydream controller not connected";
private const string CONTROLLER_SCANNING_MESSAGE = "Scanning for Daydream controller...";
private const string NON_GVR_PLATFORM =
"Please select a supported Google VR platform via 'Build Settings > Android | iOS > Switch Platform'\n";
"Please select a supported Google VR platform via 'Build Settings > Android | iOS > Switch Platform'\n";

private const string VR_SUPPORT_NOT_CHECKED =
"Please make sure 'Player Settings > Virtual Reality Supported' is checked\n";
"Please make sure 'Player Settings > Virtual Reality Supported' is checked\n";

private const string EMPTY_VR_SDK_WARNING_MESSAGE =
"Please add 'Daydream' or 'Cardboard' under 'Player Settings > Virtual Reality SDKs'\n";
"Please add 'Daydream' or 'Cardboard' under 'Player Settings > Virtual Reality SDKs'\n";

// Java class, method, and field constants.
private const int ANDROID_MIN_DAYDREAM_API = 24;
Expand All @@ -63,10 +66,10 @@ public class DemoInputManager : MonoBehaviour

// Buttons that can trigger pointer switching.
private const GvrControllerButton pointerButtonMask =
GvrControllerButton.App |
GvrControllerButton.TouchPadButton |
GvrControllerButton.Trigger |
GvrControllerButton.Grip;
GvrControllerButton.App |
GvrControllerButton.TouchPadButton |
GvrControllerButton.Trigger |
GvrControllerButton.Grip;

[Tooltip("Reference to GvrControllerMain")]
public GameObject controllerMain;
Expand Down Expand Up @@ -120,8 +123,8 @@ void Start()
// The list is populated with valid VR SDK(s), pick the first one.
gvrEmulatedPlatformType =
(XRSettings.supportedDevices[0] == GvrSettings.VR_SDK_DAYDREAM) ?
EmulatedPlatformType.Daydream :
EmulatedPlatformType.Cardboard;
EmulatedPlatformType.Daydream :
EmulatedPlatformType.Cardboard;
}
isDaydream = (gvrEmulatedPlatformType == EmulatedPlatformType.Daydream);
#else
Expand All @@ -134,17 +137,17 @@ void Start()
if (vrDeviceName != GvrSettings.VR_SDK_CARDBOARD &&
vrDeviceName != GvrSettings.VR_SDK_DAYDREAM)
{
Debug.LogErrorFormat("Loaded device was '{0}', must be one of '{1}' or '{2}'",
Debug.LogErrorFormat("Loaded device was '{0}', must be one of '{1}' or '{2}'",
vrDeviceName, GvrSettings.VR_SDK_DAYDREAM, GvrSettings.VR_SDK_CARDBOARD);
return;
return;
}

// On a non-Daydream ready phone, fall back to Cardboard if it's present in the list of
// enabled VR SDKs.
// On a Daydream-ready phone, go into Cardboard mode if it's the currently-paired viewer.
if ((!IsDeviceDaydreamReady() && playerSettingsHasCardboard()) ||
(IsDeviceDaydreamReady() && playerSettingsHasCardboard() &&
GvrSettings.ViewerPlatform == GvrSettings.ViewerPlatformType.Cardboard))
(IsDeviceDaydreamReady() && playerSettingsHasCardboard() &&
GvrSettings.ViewerPlatform == GvrSettings.ViewerPlatformType.Cardboard))
{
vrDeviceName = GvrSettings.VR_SDK_CARDBOARD;
}
Expand Down Expand Up @@ -195,7 +198,7 @@ void Update()
#if !RUNNING_ON_ANDROID_DEVICE
UpdateEmulatedPlatformIfPlayerSettingsChanged();
if ((isDaydream && gvrEmulatedPlatformType == EmulatedPlatformType.Daydream) ||
(!isDaydream && gvrEmulatedPlatformType == EmulatedPlatformType.Cardboard))
(!isDaydream && gvrEmulatedPlatformType == EmulatedPlatformType.Cardboard))
{
return;
}
Expand Down Expand Up @@ -235,7 +238,7 @@ public static bool playerSettingsHasCardboard()
element => element.Equals(GvrSettings.VR_SDK_CARDBOARD));
}

#if !RUNNING_ON_ANDROID_DEVICE
#if !RUNNING_ON_ANDROID_DEVICE
private void UpdateEmulatedPlatformIfPlayerSettingsChanged()
{
if (!playerSettingsHasDaydream() && !playerSettingsHasCardboard())
Expand All @@ -246,51 +249,51 @@ private void UpdateEmulatedPlatformIfPlayerSettingsChanged()
// Player Settings > VR SDK list may have changed at runtime. The emulated platform
// may not have been manually updated if that's the case.
if (gvrEmulatedPlatformType == EmulatedPlatformType.Daydream &&
!playerSettingsHasDaydream())
!playerSettingsHasDaydream())
{
gvrEmulatedPlatformType = EmulatedPlatformType.Cardboard;
}
else if (gvrEmulatedPlatformType == EmulatedPlatformType.Cardboard &&
!playerSettingsHasCardboard())
!playerSettingsHasCardboard())
{
gvrEmulatedPlatformType = EmulatedPlatformType.Daydream;
}
}
#endif // !RUNNING_ON_ANDROID_DEVICE
#endif // !RUNNING_ON_ANDROID_DEVICE

#if RUNNING_ON_ANDROID_DEVICE
// Running on an Android device.
private static bool IsDeviceDaydreamReady()
{
// Check API level.
using (var version = new AndroidJavaClass(PACKAGE_BUILD_VERSION))
#if RUNNING_ON_ANDROID_DEVICE
// Running on an Android device.
private static bool IsDeviceDaydreamReady()
{
if (version.GetStatic<int>(FIELD_SDK_INT) < ANDROID_MIN_DAYDREAM_API)
{
// Check API level.
using (var version = new AndroidJavaClass(PACKAGE_BUILD_VERSION))
{
if (version.GetStatic<int>(FIELD_SDK_INT) < ANDROID_MIN_DAYDREAM_API)
{
return false;
}
}

// API level > 24, check whether the device is Daydream-ready..
AndroidJavaObject androidActivity = null;
try
{
androidActivity = GvrActivityHelper.GetActivity();
}
catch (AndroidJavaException e)
{
Debug.LogError("Exception while connecting to the Activity: " + e);
return false;
}
}

// API level > 24, check whether the device is Daydream-ready..
AndroidJavaObject androidActivity = null;
try
{
androidActivity = GvrActivityHelper.GetActivity();
}
catch (AndroidJavaException e)
{
Debug.LogError("Exception while connecting to the Activity: " + e);
return false;
}

AndroidJavaClass daydreamApiClass = new AndroidJavaClass(PACKAGE_DAYDREAM_API_CLASS);
if (daydreamApiClass == null || androidActivity == null)
{
return false;
}

return daydreamApiClass.CallStatic<bool>(METHOD_IS_DAYDREAM_READY, androidActivity);
}
}

AndroidJavaClass daydreamApiClass = new AndroidJavaClass(PACKAGE_DAYDREAM_API_CLASS);
if (daydreamApiClass == null || androidActivity == null)
{
return false;
}

return daydreamApiClass.CallStatic<bool>(METHOD_IS_DAYDREAM_READY, androidActivity);
}
#endif // RUNNING_ON_ANDROID_DEVICE

private void UpdateStatusMessage()
Expand Down Expand Up @@ -329,7 +332,7 @@ private void UpdateStatusMessage()
string vrSdkWarningMessage = isVrSdkListEmpty ? EMPTY_VR_SDK_WARNING_MESSAGE : "";
string controllerMessage = "";
GvrPointerGraphicRaycaster graphicRaycaster =
messageCanvas.GetComponent<GvrPointerGraphicRaycaster>();
messageCanvas.GetComponent<GvrPointerGraphicRaycaster>();
GvrControllerInputDevice dominantDevice = GvrControllerInput.GetDevice(GvrControllerHand.Dominant);
GvrConnectionState connectionState = dominantDevice.State;

Expand Down Expand Up @@ -370,7 +373,7 @@ private void UpdateStatusMessage()
messageCanvas.SetActive(isVrSdkListEmpty ||
(connectionState != GvrConnectionState.Connected));
#endif // !UNITY_ANDROID && !UNITY_IOS
}
}

private void SetVRInputMechanism()
{
Expand Down
Loading

0 comments on commit 04a79a1

Please sign in to comment.