Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System.Collections;
- using System.Collections.Generic;
- using UnityEngine;
- // by @kurtdekker - handy example of simple persistent settings.
- //
- // To use, just use the variables like any other:
- //
- // SETTINGS.VolumeLevel = 1.0f;
- //
- // if (SETTINGS.EnableTurboMode)
- // {
- // // Do turbo-mode stuff
- // }
- //
- public static class SETTINGS
- {
- private static string s_VolumeLevel = "VolumeLevel";
- public static float VolumeLevel
- {
- get
- {
- return PlayerPrefs.GetFloat(s_VolumeLevel, 1);
- }
- set
- {
- PlayerPrefs.SetFloat(s_VolumeLevel, value);
- }
- }
- private static string s_EnableTurboMode = "EnableTurboMode";
- public static bool EnableTurboMode
- {
- get
- {
- return PlayerPrefs.GetInt(s_EnableTurboMode, 1) != 0;
- }
- set
- {
- PlayerPrefs.SetInt(s_EnableTurboMode, value ? 1 : 0);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement