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

Summary


In this chapter, you learned how to create a 3D UI root. We saw how to calibrate the 3D UI's scale to match the screen's pixel size.

We created a 3D score counter that scales up before it increases gradually towards the new score value. Anchors were used to make sure it is visible in most common screen sizes and aspect ratios.

A specific 3D pause menu was created with an interaction override collider to avoid interactions with the game while it's paused, using Time.timeScale = 0.

You also learned that NGUI widgets can be displayed within the 3D environment if these simple conditions are met:

  • At least one of its parents has the UIPanel component attached to it

  • The widget lies within the main camera's layer mask, usually in Default

We used this technique to add the current level's name in the environment.

Lighting effects were added to the level's name label and background. In order for them to react to lights, we needed to enable the Normals option on the parent UIPanel, and also make sure...