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!
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:
In the Hierarchy view, select our
Options
|Volume
GameObject.At the bottom of the Inspector view, click on the Add Component button.
Type
alpha
to search for components with that word.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.