- Home /
Unity 5.6 + GVR 1.3 what's the right way to setup for VR?
I've downloaded the Unity 5.6 and GVR 1.3 but I can't figure out what's the right way to go in VR mode.
I understand that 5.6 has the native VR support, so do I still need the GvrViewerMain in my scene?
If not, how do I test my game in VR mode from the editor? Because if is remove the GvrViewerMain from the scene and hit Play it't not in VR mode.
I want some scenes to be nonVR and some scenes in VR, before you could control that by placing the GvrViewerMain prefab to the scene, how to do that now?
Cheers!
Answer by BodhiPurplePill · Apr 07, 2017 at 03:08 PM
For native cardboard builds, you can disable and re-enable VR mode with UnityEngine.VR.VRSettings.enabled
As far as i know, GvrViewer only simulates this in the editor. For builds, you don't need to add it. Switching vr mode on and off in the editor can be done with the boolean VRModeEnabled on your GvrViewer instance.
Hey thanks for the reply!
That would be a good approach for me but for some reason VRSettings.supportedDevices.Length
returns 0 on my phone which is ASUS zenfone 2 that does support Cardboard and has gyro. I've added the Cardboard SD$$anonymous$$ to the list under 'Virtual Reality Supported' in 'Player Settings'. Any ideas why?
"Virtual Reality Supported" has to be enabled in player settings for the sdk's to be included in the build.
To avoid vr mode while starting up, you could try setting "none" to the top of the list. Then load cardboard at runtime with LoadDeviceByName("cardboard")
Answer by fiixed · Apr 07, 2017 at 04:08 PM
Follow this tutorial...its written by a Google employee. Will get you setup with a basic Daydream scene using GVR 1.3:
http://www.sdkboy.com/2016/12/building-daydream-controller-based-app-scratch/
Answer by rooskie · Apr 10, 2017 at 12:43 PM
OK so here is where I'm at at the moment. I have Unity 5.6 and GVR for unity 1.3. I have worked out how to switch from non VR to VR modes, by doing LoadDeviceByName("cardboard")
however while this works on my old SONY Xperia Z3 it doesn't work on my ASUS Zengfone 2 even though VRSettings.supportedDevices
returns "cardboard". Looking through the log from adb logcat
I see this error: DllNotFoundException: gvr. Seems like a Unity issue.
Your answer
![](https://koobas.hobune.stream/wayback/20220612114909im_/https://answers.unity.com/themes/thub/images/avi.jpg)