Unity UI: Ease of Building User Interface Elements

Unity is a really great tool to build User Interfaces for games or for real-world applications. Everything you need you get out of the box in the Unity Editor. To create a UI element just add under Hierarchy window a new UI objects like text, image, button or other one depending on what you need.

Probably the most commonly used element of a user interface case is text. It is needed to display points earned during the game, instructions, or information about the end of the game. Just adding UI objects is easy, but to make them interactive you need to write scripts.

Let’s look at the below example of score system:

Remember to use namespace UnityEngine.UI, then connect the text object to _scoreText variable.

Assign a custom content to the _scroreText and updating is pretty simple like it is shown in above script.

Of course, the UI in Unity offers many more possibilities. To learn more, have a look at the Unity documentation at the following link: https://docs.unity3d.com/Manual/UIToolkits.html.

Hi, I’m Damian, a Unity Software Engineer who loves building education and simulation games.