This topic will explore the basic concepts of Graphical User Interface in Unity.
A user interface lets users interact with the system inside a game or a computer.
A graphical user interface (GUI) is a special set of components responsible for sending information to, and reading information from, the user. It is a special layer that sits between the player and the actual game. The role of the GUI is to display important information to the user and sometimes read data back from the user. In Unity, the GUI consists of several controls that are created in code. These controls are things like labels, buttons, text boxes, and sliders.
GUI Design
As a general rule, you want to design your GUI ahead of time. A fair bit of thought needs to go into what data you display on the screen, where it will be displayed, and how. Too much information will cause the screen to feel cluttered. Too little information will leave the players confused or unsure. Always look for ways to condense information or make information more meaningful. Your players will thank you.
Creating the GUI
Because the GUI is created through code, it can be added to any script and any object. This can make for an organizational issue if you aren’t careful. Placing bits of the GUI code in multiple scripts can make finding the parts that you want difficult. Furthermore, bugs become harder to track down and fix. Placing GUI parts on multiple objects also makes it difficult to define what object is responsible for the GUI. A good way to handle this is to put all of your GUI code together in a specifically designated object. Putting all your GUI stuff in the same spot makes for easier game development.
GUI example, © copyright Romanov for Royal Design Studio
Does every game need a GUI?
Usually, a game benefits from having a well-thought-out GUI. It is rare for a game to have no GUI whatsoever. That said, it is always a good idea to go light with a GUI. You definitely do not want to overburden your players with too much clutter.
Are there any performance considerations to using a GUI?
Yes, there are. The GUI system in Unity can be a very inefficient system if used too much. This is especially true on mobile platforms. That is not to say that the GUI system should not be used. It should just be used sparingly and appropriately. Again, it all comes back to only using the GUI to display what is needed without trying to put too much on the screen.
Here are some of the considerations to make when creating the UI for your game.
- What choices are players making?
- How do you make the effect of a choice clear?
- How do you encourage players to interact with the correct element?
Unity has developed its own UI toolkit here.
Let’s watch the following video by one of the major game studios, Riot Games on creating UI design.
In this activity, you will review the UI in the following gameplay trailer from PS game - Stray.
- Think about what you like and do not like about each user interface.
- Create several sketches of the user interface for the game you are designing.
- Identify what controls are used
- Identify design for buttons and any other design components
Share, discuss, and compare your findings on the forum with your peers.
Welcome to the next Unity Learn series. | |
---|---|
Total Tasks: | 1 |
Description: | In this series, you will get familiar with Unity’s basic UI components while thinking about your prototype and what kinds of UI components you might need for your games. |
Total Time Budget: | 1 hours 15 minutes |
Time budget: 1 hour 15 minutes
Description: Get familiar with Unity’s basic UI components. Think about your prototype and what kinds of UI components you might need for those games.
This Unity learning opportunity could take you about one and a half hour, don't rush. We'll see you back here when you're done.
If you get stuck, don’t be shy to ask for help, remember that you can book in a contact time with a tutor.
Access Task 1: UI Components
Welcome back!
Did you enjoy learning about UI components?
Let’s reflect on your Unity Learn experience and record them in the forum.