Ease of Building UI Elements in Unity

What good is a game without a User Interface (UI)?
Every shooter game needs a Scoring System, Main Menu screen, Game Over screen, etc. Unity has a wonderful UI elements system to help create a User Interface.

I implemented a scoring system first. This system was built to display how many enemies was destroyed by the player (the USER).

  • The UI is created by right clicking inside the Hierarchy panel, selecting UI, and the “Text” element. I named my “Text” element “Score_Text”.
Adding Canvas to Hierarchy Panel

This will create two things in the Hierarchy panel. The first is the Canvas, where the “Text” element will reside. This is where the UI visuals will be placed for display. The second is the EventSystem. This system allows the USER to interact with the elements on the Canvas; (i.e. buttons, text, etc.).

  • Inside the Inspector panel settings for the “Text”, I changed the text to “Score: 50”, the font size to “20”, and the font color to white. I then positioned the “Score: 50” text to the top right by utilizing the Anchor Presets.
  • To ensure your Score text resizes properly for different screen sizes, I changed the Canvas Scaler’s UI Scale Mode to “Scale With Screen Size”.

Thanks for reading this article. Please follow me on Medium to be notified of my upcoming articles.

--

--

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
James Hills

James Hills

I am a married father of 5 children. I decided at 13 years of age that I was going to become a Software Developer.