Bummer! This is just a preview. You need to be signed in with a Basic account to view the entire video.
Start a free Basic trial
to watch this video
Now that we've simplified the controls, we need to make it easy for new players to understand them. One approach that's gaining popularity is to apply labels to the virtual representations of the controllers.
Resources
- User Interfaces in VR - Project Files - This is a zip file that contains the Unity project for this course. Download the file, unzip it, and then open the project in Unity.
-
0:00
Now that we've simplified the controls we need to make it easy for
-
0:03
new players to understand them.
-
0:06
One approach that's gaining popularity is to apply
-
0:09
labels to the virtual representations of the controllers.
-
0:13
So when the player looks down at the controllers in their hands
-
0:16
they can see a text label of each button.
-
0:20
When the game starts will show all of the labels by default.
-
0:25
And then if the player wishes to hide the labels
-
0:28
they can press the application menu button at the top of the controller.
-
0:33
Let's jump back into unity and create these labels.
-
0:38
In the hierarchy turn off the geometry and basketball game objects.
-
0:46
So we'll select geometry.
-
0:48
And uncheck it in the inspector and
-
0:51
then select basketball and uncheck that as well.
-
0:56
Next back in the hierarchy open up one of the controllers
-
1:04
and select the model game object.
-
1:09
Then in the inspector on the steam V-R render
-
1:14
model component change the model override to VR
-
1:19
controller vive 1.5 down here at the bottom.
-
1:24
Then let's frame it up in the inspector.
-
1:28
This will make the controller model visible while we're in the editor and
-
1:33
hiding the other geometry nearby makes it easier to see it.
-
1:39
Next, in the hierarchy create a new game object underneath the controller.
-
1:46
So we'll go to the Create menu and choose Create Empty Child
-
1:51
with the controller selected.
-
1:55
And then name it tutorial.
-
2:01
This game object will hold several UI canvases that will
-
2:05
label each button on the controller.
-
2:10
Now create a canvas.
-
2:16
Then delete the event system game object, And
-
2:21
then parent the new canvas to the to tutorial game object.
-
2:29
Rename the canvas to Teleport
-
2:36
as this canvas will label the touchpad with the word Teleport and
-
2:41
some angle brackets to make arrows.
-
2:44
In the inspector change the canvas render mode to World Space
-
2:52
and then reset the rect transform.
-
2:56
And then change the scale to 0.01,
-
3:05
On x, y, and z.
-
3:08
And then change the width to 8 and
-
3:14
the height to a value of 2.
-
3:18
Then frame it up in the scene view.
-
3:23
Scaling the canvas like this will allow us to use relatable values for
-
3:27
the width and height.
-
3:29
The alternative is to set the width and height to very small decimal values and
-
3:35
leave the scale alone, but I think this way makes more intuitive sense.
-
3:41
Now add a text component to the canvas.
-
3:45
So in the hierarchy, we'll create a new UI Text
-
3:49
game object with the canvas selected so it becomes parented.
-
3:54
And at first, we won't even be able to see
-
3:58
the text because it's not the right size and there's not enough pixel density.
-
4:04
However, we can increase the effective resolution of the canvas.
-
4:08
Select the canvas in the hierarchy once more, which is named Teleport.
-
4:14
And on the canvas scalar component,
-
4:18
change the dynamic pixels per unit to 50.
-
4:23
This will increase the pixel density on dynamically generated UI
-
4:28
elements like text so that it's clear and readable.
-
4:33
Now select the text game object and
-
4:38
reset its rect transform so that its in the center.
-
4:45
And then we'll use the anchor box hold down alt and
-
4:52
stretch it to the bounds of the canvas and
-
4:58
then change the font size of the text to 1.
-
5:04
And now finally the text is actually visible.
-
5:10
Next change the text itself to two left
-
5:14
facing angle brackets and the word Teleport.
-
5:22
And then align the text to left horizontal and center vertical.
-
5:29
And finally, change the text color to white.
-
5:37
Now we need to position the canvas.
-
5:41
So in the hierarchy, select the Canvas Game Object and
-
5:47
set the x rotation in the inspector to 90.
-
5:55
That way the text is facing straight up like the controller.
-
6:03
Then in the scene view use the transform controls to position it so
-
6:08
that it's just to the right of the touchpad.
-
6:14
Now use the scene view gizmo
-
6:20
to position that properly and I think that looks pretty good.
-
6:28
When you position this make sure that you're positioning the canvas and
-
6:32
not the text itself.
-
6:34
Otherwise if you try to modify the canvas or
-
6:37
the text later on you might get some confusing results.
-
6:42
When you're done save the scene.
-
6:44
Next will duplicate our work to create the remaining labels.
You need to sign up for Treehouse in order to download course files.
Sign up