Book Image

NGUI for Unity

By : Charles Bernardoff (EURO)
Book Image

NGUI for Unity

By: Charles Bernardoff (EURO)

Overview of this book

Table of Contents (14 chapters)

Slider


Now let's add a volume slider for the user to move and select his/her volume level.

A slider template is available, enabling you to adjust parameters easily by sliding a thumb along a bar. Perform the following steps to create a volume slider:

  1. Select the Panel GameObject and create a new child with Alt + Shift + N.

  2. Rename that new child as Volume. It will be our volume settings container.

  3. Navigate to NGUI | Open | Widget Wizard and perform the following steps:

    1. Select the Slider template.

    2. Set the Dark Sprite to Empty.

    3. Set the Light Sprite to Full.

    4. Set Highlight to Thumb.

  4. With the Volume GameObject selected, click on the Add To button.

Parameters

A slider has been created. It has 6 parameters as follows:

  • Value: This is the slider's current value, which is between 0 and 1.

  • Steps: This is the number of steps to completely fill or empty the slider.

  • Direction: This is the slider's fill direction, either Horizontal or Vertical.

  • Foreground: This is the sprite used to fill the slider.

  • Thumb: This is...