Implementing the GUI
Now, we will add the 2D GUI that we created in Chapter 2, GUI Time.
Adding the script
Drag-and-drop the GUI_2D script onto the First Person Controller. Since we already have everything coded, your work is almost done for the GUI! In the scene, create a new empty GameObject and name it Empty; this will be used by the script. If you don't have default values for your GUI_2D script, set them to these values:
Current HP to
100Max HP to
100Current Bar Length to
0Current Level to
1Max Experience to
100Current Experience to
0Current Exp Bar Length to
0Max Exp Bar Length to
100
With all of this added, when you run the scene it should look like this:
