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

The input field


We want the player to be able to change his nickname. We can use an Input Field widget to create a nickname box.

Before we continue, let's prepare a container box for our input field:

  1. Select our UI Root | Options GameObject.

  2. Create a new child, empty GameObject with Alt + Shift + N.

  3. Rename this new empty GameObject to Nickname.

Now that we have our Nickname holder GameObject, we can add (and configure) the UISprite component to it to create the nickname box background:

Select our UI Root | Options | Nickname GameObject:

  1. Click on the Add Component button in the Inspector view.

  2. Type in sprite with your keyboard.

  3. Select NGUI Sprite with your keyboard arrows and hit Enter.

We now have the UISprite component on our Nickname. Configure it as follows:

  1. Select Wooden Atlas for the Atlas parameter.

  2. Change Sprite to Highlight – Thin.

  3. Change the sprite Type parameter to Sliced.

  4. Change Color Tint to {R: 180, G: 125, B: 50, A: 255}.

  5. Set Size to 520 x 280.

  6. Set its Transform position to {0, 85, 0}.

Ok, we...