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 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 and 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:
- Unity UI (uGUI)
- UI Toolkit
uGUI is an older UI system in Unity, but we’re going to use it over UI Toolkit because it’s based on GameObjects that can be easily manipulated...