Time for action – prepare the GUI
In Unity, GUIs are coded in Scripts
, which are attached to GameObject. Let's create an empty GameObject and then attach a new script to it:
Navigate to GameObject | Create Empty. A GameObject called "GameObject" appears in the Hierarchy panel:
Click on the GameObject in the Hierarchy panel and press F2. Rename it
TitleScreen
:In the Inspector panel, position the TitleScreen GameObject at x:0 y:1 z:0.
Right-click /alternate-click on a blank space in the Project panel and navigate to Create | JavaScript.
Rename the new script
TitleGUI
.Click-and-drag the TitleGUI script from the Project panel to the TitleScreen GameObject you just created in the Hierarchy panel. The TitleScreen GameObject should light up blue before you release the mouse button.
To make sure the TitleGUI script is linked to the TitleScreen, click on the TitleScreen in the Hierarchy panel. In the Inspector panel, you should see the TitleGUI script listed beneath Transform as one of the components...