Book Image

Learning NGUI for Unity

By : Charles Bernardoff (EURO)
Book Image

Learning NGUI for Unity

By: Charles Bernardoff (EURO)

Overview of this book

Table of Contents (17 chapters)
Learning NGUI for Unity
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

Creating the UI Root


In order to display UI elements, we need a 2D UI system on the scene, called a UI Root.

Note

Before we continue, please save your currently empty scene as Menu.unity.

Within our new empty scene that holds only the default Main Camera, navigate to NGUI | Create | 2D UI, as shown in the following screenshot:

By doing the above manipulation, NGUI has created the necessary components to display UI elements. Now, take a look at your Hierarchy view; you'll discover two new GameObjects as shown in the following screenshot:

We can briefly summarize their respective roles like this:

  • UI Root: This scales itself to make child widgets at a manageable size in the scene view. It also handles the UI's scaling style and size.

  • Camera: This is the camera object that views our UI elements and displays them over the 3D scene. It also handles widget interactions with the help of its attached UICamera component.

We'll see how they work in detail later. Let's first display some text on the screen!