How to work with UI in VR

Suleiman Abdullah
2 min readDec 5, 2023

--

Objective: How to work with UI in VR.

In the first step, is to add a UI element in the hierarchy, I will create a slider bar.

Select a canvas Renderer Mode, change to World Space drag and drop the XR Origin camera to the Event camera. I will copy the position of XR origin and paste it to the canvas.

I will resize the canvas now near my XR Origin

This UI won’t work, because VR use a tracking device to fire a ray cast and use different component to check the ray. So the normal canvas setting can not do anything.

The component in the red box is used to fire the ray cast, but it does not add a VR device to the implementation.

here official documentation https://docs.unity3d.com/2021.3/Documentation/Manual/script-GraphicRaycaster.html

To be able to interact with UI in VR we need to add another component called Tracked Device.

If we build our app, we will be able to interact with the UI slider now.

This is the end of this project,see in the next one.

--

--

Suleiman Abdullah
Suleiman Abdullah

Written by Suleiman Abdullah

Self taught Unity Developer, who is passion about making games ,and he loves Math For Game Development

No responses yet