O'Reilly logo

NGUI for Unity by Charles Bernardoff

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Toggle

Now that we have a volume slider, let's add an enable/disable sound checkbox, which will turn down the volume to 0 and hide our volume slider.

First, create a toggle widget as follows:

  1. Select the Panel GameObject and create a new child with Alt + Shift + N.
  2. Rename that new child as Sound. It will be our sound toggle container.
  3. Navigate to NGUI | Open | Widget Wizard and perform the following steps:
    1. Select Toggle as Template.
    2. Select the Dark Sprite as Background.
    3. Select the X Sprite as Checkmark.
    4. With the Sound container selected, click on the Add To button.

A checkbox with a label has just been created as shown in the following screenshot:

Toggle

Parameters ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required