Creating a GUI
At this point, we have several scripts working together to give players access to movement, jumping, collecting, and shooting mechanics. However, we're still missing any kind of display or visual cue that shows our player's stats, as well as a way to win and lose the game. We'll focus on these two topics as we close out this last section.
Displaying player stats
UIs are the visual components of any computer system. The mouse cursor, folder icons, and programs on your laptop are all UI elements. For our game, we want a simple display to let our players know how many items they've collected, their current health, and a textbox to give them updates when certain events happen.
UI elements in Unity can be added in the following two ways:
- Directly from the + menu in the Hierarchy panel, like with any other GameObject
- Using the built-in GUI class in code
We're going to stick with the first option, since the built...