In-game menu
In this section, we will reinforce some of our previous lessons while we add something that we need to our project. We will also learn how to add debug messages to our new system here.
Remember when I had you hit the duplicate command in the last section? Well, that was step one for this section taken care of already.
Note
Always think ahead when you can; avoid getting painted into corners.
OK, so here we will make a few changes to our 3DTextPrefab
to work as a menu button. Then, duplicate it one more time.
So, we will attach our buttons to the Skeeball machine. In order for the button to be clickable, we need to add a collider to it.
Creating the menu items
With the 3DTextPrefab selected in the Inspector
, select Add Component
and go to Physics 2D and select Box Collider 2D
:
- Now, change the text of the
TextMesh
component toStart
. - Change the
Name
toStartBtn
. - Change the
Character size
to4
. - Here is what yours might look like:
- Now, click on the
Edit Collider
button. You might notice an issue...