Game Development Reference
In-Depth Information
7. Move the game object to
-1.8
,
0.9
,
1.2
and scale down the font size to
15
to place and scale the text appropriately.
8. Let's create a button object to use the three interactive elements on the
menu. To start, create a plane, rotate it by
-90
in the x plane, parent it to the
MainMenu
plane, and set its local position to
0
,
0.1
,
0.2
.
9. Set the scale of this new object to
0.3
,
0.1
,
0.2
. Rename it to
Button1
to
make the object hierarchy more clear.
10. Create a
3DText
object, attach it to the button, and set the font size to
68
.
Set the text field to
New
.
11. The first button will be for the new action. To handle this, we will need to write
a script. Create a new script called
popupButtonScript.cs
. Attach an in-
stance of this script to
Button1
(the new button).
12. Inside this script, we will create a public enumeration that specifies all of
the actions that can occur when the button is pressed. Loading levels one
through three, showing and hiding GameObjects, instantiating a Prefab, self-
destructing, and quitting the application will be the first actions our button
supports:
public enum popUpAction {
Invalid = -1, //used to encode error
action