1
votes

In my Google Cardboard project, I have several canvases attached to walls in a room. These canvases have buttons the player can interact with. I set each canvas to World Space, but for some reason, the buttons are rendering in front of objects that should appear in front of the buttons.

update1: The UI appears behind the cube in the game and scene windows when not running. It's only when I hit play that the image appears in front of the cube. I am adding images to the UI button programatically, but the problem happens even if I add images only using the editor.

update2: If I disable the cardboard elements in my scene (i.e. use a standard fps camera setup), I do not get the issue.

Picture below: Checkerboard is UI. Gray block is 3D block. I want UI behind the block, on the wall.

checkerboard should appear behind the block

canvas object

enter image description here

2
From this screenshot, I can't tell what is UI and what is 3D object.Umair M
Where do you want the UI to be?Sourav Paul Roman
Behind the gray cube, on the wallEthan Fischer
Disable VR Mode from GVRViewer component and please post more screenshots from canvas component inspector, and object inspector. Information you provided is not enough for anyone to help you.Umair M
Okay, I will post more information later today. ThanksEthan Fischer

2 Answers

0
votes

Manually move the parent UI object behind the gray object.

enter image description here

0
votes

Someone on answers.unity3D made this suggestions:

The problem may come from the shader used by the UI element with a ZTest value set to Off or the Queue tag of the UI element's shader is "higher" than the tag of the cube's shader

Turns out, and this is apparent in the 3rd screenshot, my UI buttons did not have a material. Once I provided one, I used one that used a standard UI shader (I initially tried unlit, but that made them disappear).

I guess there are still some issues with shaders and google cardboard. Thanks guys