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

Control prefabs


The plugin comes with a number of basic widget prefabs that we can drag-and-drop: buttons, scrollbars, checkboxes, and so on. We call these control prefabs.

Where are these control prefabs? In order to find them easily, you can simply type control in the Search bar (1) of your Project view, as shown in the following screenshot:

The search results (2) are the available control prefabs. You just have to drag-and-drop the one you want into the Hierarchy or Scene view—it's as simple as that!

Background

Drag the Control – Background prefab inside UI Root in the Hierarchy view. This will place it at the (0, 0, 0) local position.

Your Hierarchy view should now look like this, with these two new elements:

We now have a new background widget composed of two overlapped sprites:

  • Control – Background: This is a dark gradient

  • BG - Stripes: This is a tiled sprite representing small stripes

Select our new Control – Background GameObject, and then:

  1. Rename it to Background.

  2. Set UISprite's Size to...