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

Scrollable text


Let's now create some welcome text that scrolls horizontally like this:

In order to achieve this, we will need clipping, which consists of displaying only a specific area of a panel. It can be set up using the Clipping parameter of UIPanel.

We'll be working on the main menu again, so let's show it in the editor: disable our UI Root | Options GameObject, and enable our UI Root | Options GameObject.

Before we configure the panel's clipping, we must create the welcome text box.

Textbox

Let's use our main menu's background as the base for this new welcome textbox:

  1. Select our Main | Background GameObject and duplicate it with Ctrl + D.

  2. Rename this new child to Welcome.

  3. Drag our new Welcome GameObject inside the UI Root GameObject.

  4. Change its Transform position to {0, 500, 0}.

  5. For its attached UISprite component:

    • Change Sprite to the Window sprite

    • Change Size to 800 x 100

    • Set Depth to 1

  6. Select the Welcome | Stripes GameObject and delete it.

  7. Select our Welcome | Border GameObject, and for its...