Setting the Score

The first step in building my UI system is setting up a system to keep track of the player’s score. To start, I need to create a UI element that displays the score on the screen. I did this by creating a new Text UI element in the Hierarchy. Once established, I can then move the text to the upper right corner of the screen. I can then anchor the text to the corner and have it move and scale with the size of the display.

Now to set up the logic for the scoring system. I created a script that manages the changes to the UI, and set up the Player and Enemy scripts to communicate. Whenever an enemy is destroyed by a laser, there is now logic that tells the player to increase it’s score by 10. The Player script then communicates to the UI manager to increase the score on the screen appropriately.

--

--

--

Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

Day in the life of…Rob Boden Product Design Lead

Case Study: Yellow Class Gamification feature

Yellow Class: Gamification feature

31 Graphic Design Areas to Specialize in

Trauma-Responsive Design Research: A New Model for Change

Ratz Club, an NFT project created by and for everyone.

Shearing the Digital

Meet Julie Talosig!

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Ken Sullivan

Ken Sullivan

More from Medium

Feature Frenzy

Damage VFX using Animated Sprites in Unity

Week 24: How to add SFX to you game without going mad

My journey becoming a Unity game developer: Make a game look beautiful-Creating Ceilings pt.1