12345678910111213141516171819202122 |
- using UnityEngine;
- namespace GFGGame
- {
- public class LocalCache
- {
- public static void SetBool(string key, bool isOn)
- {
- int value = isOn?1:0;
- PlayerPrefs.SetInt(key, value);
- PlayerPrefs.Save();
- }
- public static bool GetBool(string key, bool defaultValue)
- {
- int defaultInt = defaultValue?1:0;
- int value = PlayerPrefs.GetInt(key, defaultInt);
- return value > 0;
- }
- }
- }
|