1

I am trying to create a hybrid VR/NonVR app for Android in Unity. I followed the getting started guide and tried to get a scene running which switches between VR and nonVR mode (starting in the latter if that matters):

  1. Getting Unity Daydream technical preview 5.4.2f2-GVR13
  2. Downloading and importing the SDK
  3. Setting platform to Android MinSDK 24
  4. Setting Virtual Reality Support None and Daydream
  5. Attaching a script that calls code snippet 1 every five seconds either with "None" or "daydream" as parameter.
  6. Building to a Pixel Phone

    UnityEngine.VR.VRSettings.LoadDeviceByName(string); //snippet 1

github repo is available from https://github.com/sisch/DaydreamHybridScene

Problem: When the app starts, it starts in App (NonVR) mode. Logcat shows the implemented Debug.Log Messages every five seconds. However, nothing else happens. Especially the screen stays in one camera 2D mode. I was expecting to see a switch between stereoscopic VR view and plain old 2D app view.

I am lost, any hints on what I am doing wrong are highly appreciated. (I am new here, so hints on how to improve the question are welcome as well)

0

1 Answer 1

1

So, I finally found the issue and will leave this answer for future reference.

I started over from scratch a few times. In the end, it was stupidity as I was just missing the two lines marked below

UnityEngine.VR.VRSettings.LoadDeviceByName("daydream");
// wait one frame                         //<--
UnityEngine.VR.VRSettings.enabled = true; //<--

LoadDeviceByName does initialize the Daydream GvrViewer as determined by logcat output, but it does not implicitly activate the StereoController.

I also uploaded the changes to github. Thus, you can find a bare, working Scene (starting in NonVR) and switching every 10 seconds for Unity 5.4.2f2-GVR13 on github: tag=StackoverflowAnswer

3
  • Since I was getting errors when I implemented this,I downloaded your project to see how the implementation was. I built the code and deployed it on a device but I getting errors Error obtaining VrCore client API version and Null GVR context pointer, could not get GVR user prefs' handedness. Any idea why? Feb 14, 2017 at 5:30
  • Just to make sure: Have you set platform to Android, API level to Nougat, and VR support to daydream? Are you using the 5.4.2f2-GVR13 technical preview? Did you install the unitypackage? If all questions answered with yes, please open an issue with the error log on Github. Thanks :) Feb 14, 2017 at 10:43
  • I have added cardboard too as a VR device since its suppose to be a hybrid app. Also, I am currently testing on a non-daydream device. Will that make a difference?Since its a hybrid app, it should still work, right? Feb 15, 2017 at 5:04

Not the answer you're looking for? Browse other questions tagged or ask your own question.