上QQ阅读APP看书,第一时间看更新
Creating the UI Root
In order to display UI elements, we need a 2D UI system on the scene, called a UI Root.
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!