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

Hiding and showing the volume box


When the sound is disabled, it is pointless to show the two volume sliders. Let's make sure they are only displayed if the sound parameter is checked. While we're at it, we'll make it look nice with a smooth fade in or fade out of the volume box!

Tween Alpha

The Tween Alpha component will help us modify the volume box's alpha smoothly. It works in a similar to other Tween components we've seen so far.

Follow these steps to add the Tween Alpha component to our volume box:

  1. In the Hierarchy view, select our Options | Volume GameObject.

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

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

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

Ok, we've just added the Tween Alpha component to our main menu window. Let's configure it to fade our volume box.

Volume box fade

We need to configure this new Tween Alpha component to make it fade our volume box in by tweening its alpha from...