Game Development Reference
In-Depth Information
Building the main menu pop up
Let's put all of this together and build a functional and extensible pop up for the main
menu.
This pop up will display the name of the game on the title screen and present the user
with three working buttons. From this, we will be able to make a pop-up Prefab that
can be used for other UI. Perform the following steps to create a main menu pop up:
1. To start, let's create the base of the panel. Create a plane that will be the base
of the pop up. Set its position to 0 , 0 , 8.6 and its X rotation to -90 .
2. Scale the panel to 1.54 , 1 , 1 so that it is a bit wider than it is tall.
3. On the MeshRenderer , we associate a new material called popupMateri-
al . This material has a white-colored component and a texture that is opaque
gray with round edges with full alpha. Applying this material makes the plane
appear rounded at the corners.
4. Let's rename the plane to popup_MainMenu to reflect its actual role.
5. The main menu pop up will have four child objects: a text field for the pop-up
title and three child objects for the buttons.
6. Create a 3DText object, parent it to the MainMenu panel, and set its local
position to 0 , 0.1 , 3 . This will place the text in front of the panel, that is, front
and center. Set the anchor to middleCenter and the font size to 21 . Set the
font style to Bold .
Search WWH ::




Custom Search