UI in VR

David Brown
3 min readJun 3, 2022

--

Objective: Explain how UI works in VR. We’ll even discuss a fade to black system.

You may have gotten to a point in your VR game, and you realized your UI isn’t showing up. That’s because UI in VR is a little different. The normal way you display a canvas is like this.

Instead, we need to use a world space canvas and drag your main camera in the slot.

What Is a World Space Canvas?

A world space canvas allows you to display UI like a 3d Game object. For example, if you wanted to display UI above a 3d object you can.

Display Text Over 3D Object

Start by creating a world space canvas as a child of the object and then drag your main camera in the camera slot.

Then add some text mesh pro text above your object and resize the text. Now you are displaying UI.

Interacting with UI

If you want to interact with UI such as sliders and buttons you can use the ray interactor. Just set the layer of the interactor to only UI. Then make the UI in your scene have the UI layer.

Fade To Black System

Now let’s discuss the fade to black system. To make this system create a canvas as a child of the main camera. Then create an image and set the color to black. Now put this image in the players face.

I made an animation on the image that will slowly change the opacity from 0 to 255. This is the result

Thanks for reading! If you want to play my VR game click here Space Cadet VR by JokingJester1 (itch.io)

--

--

David Brown

I like pizza, cream soda, and making games with Unity