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

Back to the menu


We want our player to be able to return to the main menu. First, we need to add a Confirm button to our options page. Secondly, we must play our existing tweens in reverse to make both windows go back to their initial states when the Confirm button is clicked.

The Confirm button

We can use our existing Play button as the base to create our new Confirm button:

  1. Select UI Root | Main | Buttons | Play and hit Ctrl + D to duplicate it.

  2. Rename this new duplicate to Confirm.

  3. Drag this new Confirm button inside our UI Root | Options GameObject.

  4. Select our UIRoot | Main GameObject and disable it.

  5. Select our UIRoot | Options GameObject and enable it.

Make sure you move around your scene view to see your options page at {2000, 0, 0} so that we can see the next modifications. Now, we can transform our Play button into a real Confirm button:

  1. Select our new Options | Confirm GameObject.

  2. Set its Transform position to {0, -295, 0}.

  3. Set Size of its UISprite to 520 x 130.

  4. Select its child Label GameObject...