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):
- Getting Unity Daydream technical preview 5.4.2f2-GVR13
- Downloading and importing the SDK
- Setting platform to Android MinSDK 24
- Setting Virtual Reality Support None and Daydream
- Attaching a script that calls code snippet 1 every five seconds either with "None" or "daydream" as parameter.
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)
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
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