googlevr / gvr-unity-sdk

Google VR SDK for Unity
http://developers.google.com/vr/unity/
Other
2.71k stars 1.09k forks source link

Toggle VR mode at runtime in Unity2017.1.0p5 #770

Closed blacky427 closed 6 years ago

blacky427 commented 6 years ago
Found using: * Google VR SDK version: Unity build-in * Unity version: 2017.1.0p5 * Phone manufacturer, model, and O/S version: iPhone SE, iOS 11.0 Steps to reproduce the issue: 1. Follow the instruction from [https://github.com/googlevr/gvr-unity-sdk/wiki/Switching-between-VR-and-non-VR-at-runtime](https://github.com/googlevr/gvr-unity-sdk/wiki/Switching-between-VR-and-non-VR-at-runtime) 2. When you switch to VR mode at portrait, you will get weird effect in VR mode. ![img_0276](https://user-images.githubusercontent.com/12066593/32359216-58bac9aa-c01a-11e7-94f4-0266720d80a4.PNG) Workarounds: 1. Trigger SwitchToVR only when device orientation is landscape left. Even so, still have chance to get the weird effect if you switch your device's orientation quickly. ![img_0275](https://user-images.githubusercontent.com/12066593/32359234-78cc688e-c01a-11e7-81d1-ceca190b7449.PNG) ``` private IEnumerator SwitchToVR() { yield return new WaitUntil(() => Input.deviceOrientation == DeviceOrientation.LandscapeLeft); VRSettings.LoadDeviceByName("daydream"); // Or "cardboard" (both lowercase). // Wait one frame! yield return null; // Now it's ok to enable VR mode. VRSettings.enabled = true; } ```
tedruxpin commented 6 years ago

Thank you for reporting this issue, and for the work-around. I have created a bug in our tracker and will ask one of our devs to respond if there is another alternative.

tedruxpin commented 6 years ago

Hello, it turns out this is a duplicate of issue #602. An alternative workaround can be found here. I will close this issue for now, please reopen if this does not resolve your issue.

fredsa commented 6 years ago

Will continue tracking this issue as #838.