VR Cardboard - UI Screen Space Overlay Canvas with new native Carboard VR SDK in Unity 5.6.0

Hi everyone!

I have been working with Cardboard SDK Package to create VR experiencies and I have been using UI - Screen Space Overlay Canvas for creating buttons in order to disable VR-Mode, go back to main menu, and set up different options, but with the new Unity 5.6 version the UI seems to dissapear under the stereo split cardboard image. Using the Cardboard SDK Package I could set my UI elements over the split screen, but with the new native way the UI Screen Space Overlay is hidden. In spite of this, for example if I have a UI button and touch where it is, it works, but is hidden.

I don’t know if anyone else has the same issue or has find another way for doing this.

Thanks!

With native integration, there is no support for screen space overlays. This is standard across all VR devices in Unity in general. You’ll need to move your UI to World Space to get it to appear in VR.

Hi Joejo,

thanks for you very much for your fast reply!

Is there anyway to show cardboard VR as monoscopic, and later, when user presses at cardboard button - change into stereoscopic ? I don’t want user to directly get into VR as landing page downloads content, so until the download is finished it will remain monoscopic and after the download is complete it will change to stereoscopic. I am building with Unity 5.6.0f3 with google cardboard sdk 1.4.

With native google vr integration use VRSettings.enabled and set it to false
Use the InputTracker(dunno the right name out of mind) for getting the rotation from the sdk if you still want to keep on using the head tracking
Apply it to the camera
This is called ‘magic window mode’ somewhere in the unity documentation

It used to work nicely. Start app in screen space UI, chose stereo or mono and away you go.

Now I cannot figure it out. So I’ve ditched the UI. I can toggle VR off in script so it starts in mono but when I toggle it back to VR it doesn’t render the cameras. If I start in VR and toggle to mono and back it is fine.

I use

Gvr.Viewer.Instance.VRModeEnabled = !GvrViewer.Instance.VRModeEnabled

along with the Gvr Viewer script

Any thoughts would be appreciated.

In fact this only works in the editor not when built for android. sigh.

Hi Mike,

I’m trying to do the same thing, switching between “Magic Window” and “Cardboard”. I wish there was a “Magic Window” Device instead of the weird “Load Cardboard but set VR to false” way of doing things. You need to wait frames between switching aswell for it to work. (co-routines)

Sad that we can’t render on top of VR anymore but I understand why. To me it’s more of a problem that the native settings and close button can’t be “skinned” and most anoying in 5.6.0f3 is that the close button always closes the app.

How is it possible to make a screen fade in/out effect then? I have a game in development where the player can teleport to some specific location using reticle pointer, having a fade in/out effect during teleportation makes the experience much more smooth!

1 Like

Except for Google VR: they have screen-space overlays of an X/Back button and a Settings button on the edges of the screen.
We would like to add our own, 3rd button in the lower left that enables the user to toggle VR mode on and off.

What workaround does Google VR use? How do we use that same workaround?

Those are Android Widgets that Google lays over the display view. Unity has nothing to do with those UI elements at all.

First, thank you for replying! I really appreciate every bit of time and help.

Secondly, I’m confused here, and maybe not communicating well, so let me start over with more detail:
When enabling the “cardboard” device in Unity’s native VR integration, a screen UI overlay appears on both iPhone and Android devices (screenshot of me pressing the “back” button on iPhone below:)
3218118--246567--iPhone_NativeCardboard_Small.png
This is a barebones project with no external SDKs added.
So their native integration is somehow drawing this UI overlay, and unlike Android, iOS doesn’t permit any apps to draw widgets over the top of others. I’m not really sure how they do this, as there’s no published code, or documentation for this anywhere.

Prior to their native integration with Unity, the Google Cardboard Unity plugins did this same UI overlay thing.

If Unity isn’t involved in rendering this UI overlay, it must be possible for an iOS Unity plugin to render things on the screen outside of Unity’s involvement? If so, how might we go about doing the same?

Any further help you can provide is much appreciated, I’m at a loss here!

I can not really speak to what was happening before. What I can tell you now is that that view is created by Google through their library. We have no responsibility for any of the UI widgets they overlay (Back/X button, settings button, eye divider line).

For either platform you could try to manually walk/inspect the view hierarchy and try to inject your own UI items but I can foresee a number of issues, primary of which is an inability to get into the Google VR Play store with that.

1 Like

Thanks for the help, joejo – that UI injection approach sounds pretty fragile, and we will investigate other routes, but good to know its possible.

Do you happen to know at what point would we do that UI injection? (e.g. At any point after enabling VR? Or in OnGUI?)

Lastly, are there technical reasons (performance, undefined behavior, etc.) that Unity disables the Screen Space - Overlay canvases or is it purely because its generally a terrible, user-headache-inducing practice for most VR scenarios?

Thank you again, I’ll stop with the deluge of questions =)

I believe the technical issue has to do with reprojection. Even though we may have the screen overlay locked, the device itself will reproject the display as needed and so the “locked” screen overlay will have a tendency to drift around.

1 Like

Will this be fixed. This locked cardboard UI is not a very professional approach, as companies like to control their user experience, and as long as it is close/the same as the default one why would that be a problem?

1 Like

Sounds like Google wants nothing to do with it:

https://github.com/googlevr/gvr-unity-sdk/issues/643#issuecomment-350128823

Really unfortunate.

There us no way??? There are many VR player apps with screen space overlay buttons for switching vr-non vr mode. !!! Please help

1 Like

The X at the left top sends an Escape key event. On that event you can disable VR…
But anything that has to do with your own game UI has to be either Camera Space UI (Discouraged as it is static in view) or World Space UI.