Google Cardboard VR HUD UI Issue - unity3d

I'm currently creating a google cardboard vr app and I'm running into an issue for the UI. The VR app is set up to be on rails by creating an animation for an empty object that contains the google cardboard camera prefab. I have a world space canvas that has 3 UI objects (backwards, pause, and forward similar to the iphone). In the first case the UI works for pausing (time scale set to 0) as seen in the image below.
However the issue I'm having is having those UI icons show up while in motion. The icons seem to go off in a weird direction have a mind of their own - even though I can track the canvas and know it's in the same position relative to the camera. If I pause in game or in the editor it returns to the correct state in example 1.
I have the canvas set to world space and the event camera is the google cardboard camera prefab. I'm not sure what's going on.

Related

OVRCameraRig not displaying both camera eyes in Unity player?

Unity 5.5.2f1
I'm trying to get started with making an Oculus app, following the instructions here, modifying a very simple scene I made. However, when I disable the MainCamera and drag in the OVRCameraRig, and run it in the Editor, I still only see a single frame, not these multiple eye views like in the picture. Player settings have "VR Supported" selected. Do I have something not set up right with the app? Or is the tutorial out of date or something?

Unity UI canvas not working with VR

I have been trying to get a very simple demo of a native Unity UI canvas working with VR.
I have read the oculus blog post here: https://developer3.oculus.com/blog/unitys-ui-system-in-vr/ but i need to use the native unity UI as i want to redistribute the code without license worries.I followed this tutorial https://unity3d.com/learn/tutorials/topics/virtual-reality/interaction-vr?playlist=22946 and downloaded the unity vr samples project from the asset store. In this they provide some scripts to place on the camera (VRInput and VREyeRaycaster) and some scripts to place on the target object (VRInteractiveItem and ExampleInteractiveItem).
When i apply the target scripts to a regular GameObject in the scene (e.g. a cube) the raycast works fine and the appropriate calls are made when fire1 is activated. When i try and do this for a canvas object (e.g. a button) - no hit is detected. I have tried placing the two target scripts (VRInteractiveItem and ExampleInteractiveItem) on the canvas, the image containing the button and the button itself and none work. What am i doing wrong? Why would it work on a regular gameobject and not on a UI canvas? I have made sure all my canvas elements have their raycast target boolean property ticked
EDIT:
It seems to work when i attach a box collider to the UI element, is this required? i thought it should just work with a GraphicsRaycaster attached. but the configuration below doesn't work (when box collider is disabled and graphics raycaster is enabled)
This is what is on my players camera:
I dont have a problem using box colliders if i have to but i wanted to take advantage of the UI buttons changes in highlighted and pressed color properties
In Unity raycasting works only with game objects having colliders. Raycast returns true when it hits a collider. Without colliders there is nothing the ray can hit.
Unity Physics.Raycast documentation
I believe, for anyone just seeing this for the first time, a potential reason it is not working is because the canvas from the above picture is using a "Graphics Raycaster" element and not an "OVR Raycaster" element. The OVR Raycaster is meant to replace the graphics raycaster to connect Oculus to Unity UI.
If you want to use the unity's UI in VR you might want to take a look at this asset: VRTK
There are some examples of VR UI using controllers or camera targeting.
Go to your canvas, you should have an option that is "Plane Distance" it's set to 100 , I change it to 0.5 and it works quite well.

Canvas UI does not render in GVR (Google Cardboard) in Unity 5.3.5

Background
I am using Unity3D 5.3.5 to develop a Google VR (Cardboard) project
Introduction
I added a canvas button to my scene. It shows up in scene mode and sometimes in Game mode but never when I run the project
What I have tried
Turning off Direct Render for Main Camera
Setting up Render Mode of canvas to World Space
Adding Main Camera to Event Camera
Observations
Button shows up in Scene and Game Mode but not during Play mode
Though the UI does not show up, Physics Raycaster in the reticle hits the button.
Screenshots Below
This is a Unity bug. In the forums they mentioned it will be fixed in 5.3.5p5.
Its also noted in known issues for gvr:
Starting with 5.3.4p2, a bug in Unity prevents rendering World Space
uGUI Canvases into a RenderTexture
https://developers.google.com/vr/unity/release-notes#v080_initial_release
It works in older version(5.3.4f1), if you need to test it right now.
in your canvas change Render Mode to-> Screen Space Camera
change Render Camera to -> Your camera
change Plane Distance to a very low number but not negative

Pause/Freeze a scene with a trackable active in vuforia unity 3d

I am developing an app with vuforia Cloud Recos. I want to add the feature of allowing the user to pause the page so she does not have to keep pointing the device on the target to view the trackable. This is pretty useful when I want to show texts. Is there anyway to achieve that on Unity3D ? A good example is Microsoft's Here City Lens app which includes a button to pause the page as the screenshot shows;
You could take a screenshot of the screen and apply it to an Image UI object. That is if you do not need the camera feed anymore.
If you need interaction with the elements, I would only take a screenshot of the camera feed without items. Get AR camera transform, apply it to a new camera, disable AR camera.Then apply the screenshot to a background plane covering the whole screen. Keep items on as well and they do not listen to Vuforia anymore. You are pretty much recreating a basic Unity scene. The items should not be moving with Vuforia, the camera is. So they are still in the middle and you need to know where was the camera when you took the shot. Your scene is complete

How do you make an HUD for a Cardboard game?

Currently there is no documentation whatsoever on how to make a "visor" HUD on Unity for a Cardboard game. Screen Space - Overlay does not work as rendering mode as many people have already said. Does anyone know of a workaround/method for making it using World Space rendering?
You must create your HUD in a World Space canvas, put it in front of the camera and attach it to the Head object of the Cardboard SDK. That way it will be always visible in front of the player.