Daydream Hybrid (NonVR/VR) App does not switch VR mode

1.3k views Asked by At

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)

1

There are 1 answers

3
PlantProgrammer On BEST ANSWER

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