Game Development Reference
In-Depth Information
Chapter 5. User Interfaces in Unity
To provide the level of polish necessary for commercial applications, Unity offers a
variety of user interface systems to the game programmer. Understanding what each
of these systems is designed to do, what each is good at, and how to combine them,
will enable the programmer to build retail class menus, navigation buttons, and more.
In this chapter, we will investigate, analyze, and understand these systems. We will
then apply this knowledge and build an extensible pop-up system using Prefabs for
commonly used scenarios in our game. We will finish by integrating these into mis-
sion one with an eye on future missions and future extensibility. In this chapter, we will
cover the following topics:
• Getting familiar with the Unity UI classes
• Developing the pop-up system
• Exploring the GUIText component
• Exploring the GUITexture component
• Exploring the TextMesh component
• Creating clickable text elements
• UnityScript and the GUI Button object
• Building the main menu pop up
• Testing our work
• Future extensions
Getting familiar with Unity UI classes
We will cover the following Unity UI systems:
GUIText : This component displays a 2D font in screen space. It is well suited
for the in-game HUD text that stays relatively stationary on the screen. It is
displayed in screen-relative coordinates.
GUITexture : This component displays a 2D image in screen space. It is well
suited for the background and border graphics for in-game HUD elements.
Just as the preceding component, this component is also displayed in screen-
relative coordinates.
TextMesh : This component generates a 3D mesh for a given string and dis-
plays it in the game world in 3D coordinates. This mesh can be positioned and
Search WWH ::




Custom Search