How to deactivate and activate Google Cardboard VR from script
How do I switch Google VR off and on again from script?
I'm using the Google VR SDK for Unity. I want my game to have VR mode if you have the glasses, but otherwise it's a normal 3D game.
I have the VR working in editor mode and I see the stereoscopic view. Many similar questions advice to use Cardboard.SDK.VRModeEnabled = true/false, but MonoDevelop doesn't recognize Cardboard.SDK in the namespace I'm in. If this is the way - how do I get Cardboard.SDK to work in Monodevelop? What's the "using" I have to add? I've also tried setting VRSettings.enabled = false, but this doesn't have any effect. If I disable the gameobject that has GvrViewer, Unity crashes.
Answer by herra_lehtiniemi · Feb 13, 2017 at 07:12 PM
You can disable the VR-mode by accessing the GvrView-script (either in the Google provided prefab or in the scene where you added it manually) and togging the bool VRModeEnabled to false on this script.
I'm currently struggling with an app where I have to toggle the VR mode on and off - it seems that if you want to be able to rotate the camera when VR mode is off, you have to disable the GvrHead-script that the GvrView adds onto each camera, when the VR-mode is off. Otherwise the camera rotation is locked and you can't for example use LookAt or RotateAround methods properly.
Your answer
Follow this Question
Related Questions
Correct way to handle playback with swipe gestures 1 Answer
Using Zed Camera Mesh Maker VR 0 Answers
Character Spin Issue 1 Answer
how to change the color of cube using vr gaze 0 Answers
Tetxure swap using HTC controllers 0 Answers