Creating A VR Menu - 2019.2 - Unity Learn

1. Right-click in the Hierarchy window and navigate to 3D Object > Cube (Figure 01). Click the gear widget at the top right of the Inspector window for the cube and choose Reset. This should put your cube at the origin and set the scale to 1,1,1.

2. Next, right-click in the Hierarchy window again and select UI > Canvas (Figure 02).

3. Select the Canvas and, in the Canvas component in the Inspector, change the Render Mode to World Space (Figure 03).

4. Make the Canvas a child of the cube primitive (Figure 04).

5. Then, click the gear icon on the Rect Transform component of the Canvas and click Reset. Change the Pos X, Pos Y and, Pos Z values to .1, 3.8, 0, respectively, and set the width to 15 and the height to 5 (Figure 05).

6. Right-click on the Canvas in the Hierarchy window and select UI > Panel. Set the Source Image on the Image component to None and change the color on the color picker to a color you like. This tutorial has it set to a light grey (Figure 06).

7. Your Game view should now look something like the image below (Figure 07).

8. Right-click on the panel in the Hierarchy window and select UI > Button. Rename the new button to "red_btn". Expand the button in the Hierarchy and select the text GameObject. In the Inspector window on the Text component, enter RED in all caps and select Best Fit in the Paragraph section (Figure 08).

9. Set the button’s width to 100 and the height to 33, then press the R key to select the scale tool. Scale the button down until it fits within the Canvas. Next, select the Rect Transform tool, and move the button into the left third of the Canvas (Figure 09).

10. Set the button as a child of the panel by clicking and dragging it into the panel in the Hierarchy window. With the button selected, press CTRL+D to duplicate it (CMD+D on a Mac). Select the Rect Transform tool and move the button to the center of the panel. Repeat this process one more time to create a third button and put it in the right third of the panel. Rename the new buttons to be "blue_btn" and "green_btn". Change the text on the buttons to be different colors. For this tutorial, use RED, BLUE, and GREEN (Figure 10).

Từ khóa » Vr Canvas Unity