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

Switching to options


Now, we want to show the options page when the Options button is clicked. In order to do that, we will move the main menu towards the left and disable it when it's offscreen. Simultaneously, the options window will appear from the right part of the screen.

Tween Position

The Tween Position component will help us to move these windows around smoothly. It works in a way similar to that of the Tween Scale component.

Add the Tween Position component to our main menu window:

  1. In Hierarchy, select our UI Root | Main GameObject.

  2. At the bottom of the Inspector view, click on the Add Component button.

  3. Type position to search for components with that word.

  4. Select the Tween Position and hit Enter or click on it with your mouse.

OK, we've just added the Tween Position component to our main menu window. I won't detail its parameters because they are exactly the same as the Tween Scale component, except that the From and To parameters are local positions instead of local scale coordinates...