I’m seeing rendering issues and get prompted that 5.6.0b1 doesn’t have GVR native integration. Easily reproducible with the following:
Create a new project
Switch platform to Android
Edit player settings
Enable Virtual Reality Supported
Add Daydream to Virtual Reality SDKs
Change Minimum API Level to Android 7.0 “Nougat” (API Level 24)
Build and run
Here is what I see on my Pixel.
Not ideal, but its on the device at least. So I continue with trying to get the controller API, so I…
Import GVR SDK 1.10
Receive API Update Required prompt and select I Made a Backup. Go Ahead!
Apply “yield break” fix to address compile error for Assets/GoogleVR/Scripts/Video/GvrVideoPlayerTexture.cs(595,7)
Unity prompts with Package Import Required
I stop here because this doesn’t seem right. Not really. I try other things, but I seems like I shouldn’t see this prompt at all.
Am I doing something wrong?
Not sure much changed between Daydream Technical Preview GVR13 and this beta that would remove the need for the GVR SDK 1.10. My assumption is I still need the GVR SDK for controller API, spacial audio etc. I didn’t notice any documented controller APIs, but maybe I missed it?
I saw the same thing as I tried this today. First thing I noticed was that it wasn’t picking up the GvrController class at all, which seemed odd. View the code, see that it’s all greyed out (platform specific compilation wasn’t being hit). You can see that the platform specific IF block is:
And it compiles fine, and the libraries that were added (that you mention above) are then removed when Unity sees they were added for an older version of Unity (5.4 daydream preview).
Seems like the issue is in the Google SDK, or the fact that Unity didn’t release any documentation into any Native API’s they have created here. Looks like the VRNode, VRSettings, VRDevice etc classes all could work. Everything seems generic enough and it makes sense that Unity may just use those for native control of the daydream controller and viewer (so no need for the GVR Prefabs, as mentioned in the documentation).
However a little documentation here would be great. Daydream is the reason I’m testing the Beta
After further testing, I can validate @tnydwrds workflow exactly. PC if that matters. The only difference is that I modify all scripts in the VR SDK to get the controller working. Which when I do, it does indeed work, controls my pivot. Most things look good.
Add the GvrViewerMain prefab (which we shouldn’t need any prefabs right?) and you can see it just replicates the rendering issue illustrated above. @tnydwrds did you submit a bug yet for this?
Agree. It’s unclear to me what the exact state is since the preview made similar statements. There was a caveat that the GVR SDK was required for some items which haven’t been integrated “natively” yet. So not sure if I still need the GVR SDK for controller support until more beta releases have improved integration.
No, I haven’t created a bug yet. Seems like it’s only the stereo rendering that’s a Unity bug as I can reproduce that without the GVR prefabs.
So this works for with the 1.10 SDK (modified with the platform specific IF above) with the Gvr.internal referenced namespace, with NO prefabs (GvrControllerMain). Just a GameObject (Pivot Object) with a sphere child a few units off on the Z axis (the “reticle”), and the DaydreamController (below) attached to the Pivot object. The most basic thing I can think of
using Gvr.Internal;
using UnityEngine;
public class DaydreamController : MonoBehaviour
{
AndroidNativeControllerProvider provider;
private ControllerState currentState;
private ControllerState prevState;
void Start ()
{
provider = new AndroidNativeControllerProvider();
currentState = new ControllerState();
prevState = new ControllerState();
}
void ControllerRotation(Transform pivot)
{
pivot.rotation = currentState.orientation;
}
void ButtonStates()
{
if (currentState.appButtonDown)
{
}
if (currentState.appButtonUp)
{
}
if (currentState.appButtonState)
{
}
if (currentState.clickButtonDown)
{
}
if (currentState.clickButtonUp)
{
}
if (currentState.clickButtonState)
{
}
if (currentState.touchDown)
{
}
if (currentState.touchUp)
{
}
if (currentState.isTouching)
{
}
}
void Update ()
{
provider.ReadState(currentState);
ControllerRotation(transform);
ButtonStates();
prevState = currentState;
}
}
So there’s that. I’m assuming that the internal namespace of the Gvr SDK will end up in Unity, and we will be able to access this class without importing it from the Google SDK/GitHub.
This still doesn’t explain the camera issues though, which looks like (after some close looking) like the render texture for the right eye is slid over 50% into the left eye space. Poor explanation of what I’m seeing, but it makes sense to me
Anyway, I’m going to assume that this class (AndroidNativeControllerProvider) will be used in the native unity API eventually in Beta here. I can see them leaving this out for now, given the youth of the SDK.