Ease of Building UI Elements in Unity

Rob George
1 min readApr 15, 2021

Day 18 — Aspiring Game Creator

2D Game Dev: Galaxy Shooter

Quickly showing off new UI Elements: Score, Lives Display & Game Over flash!

Objective: Create the UI Manger, the User Interface & Score, Player Lives & Game Over elements

Pseudo Code:

  • Create an empty UI Manager game object and attach a newly created UIManager class to it.
  • Ensure that the UI Scale Mode is set to Scale With Screen Size.
  • Ensure that the UI Reference Resolution matches the game resolution.
  • Create a new Text UI Element named: Score, anchor appropriately.
  • Score variable attached to each enemy game object.
  • Upon destruction, the enemy game object notifies Player class of score.
  • Player Class requests a UI update when score changes.
  • Upon Player Death Game Over flash
  • Upon Player Death Restart Game Text
  • Stop Enemy Spawning
  • Wait for User Input to Restart Game

Initially UI felt overly complicated and almost, why bother. After working on Galaxy Shooter and seeing how much UI elements add to the game look and feel and now understand that UI should have an equal investment to the rest of the game.

--

--