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

Saving options


The player's nickname is saved automatically within PlayerPrefs because its Saved As parameter is set to PlayerName. The current language is saved thanks to the Language Selection component attached to our language popup list.

We'll now use an NGUI component that helps us to save other user interface values like progress bars and checkbox states in PlayerPrefs.

The UISaved option

In order to achieve this, we simply have to attach the UISaved Option component to NGUI widgets. Select the following GameObjects we'll want to save the option to:

Select the Subtitle's List, Sound Checkbox, and Volume's SFX and Music sliders.

With the preceding selection, follow these steps:

  1. Click the Add Component button in the Inspector view.

  2. Type save with your keyboard to search for components.

  3. Select Saved Option and hit Enter or click on it with your mouse.

We've just added the UISaved Option component to our selection.

Configuration

The only parameter the UISaved Option component has is Key Name. You...