Created
March 14, 2019 17:45
-
-
Save srcnalt/28daef411ac6c36f68233d1db3127f5e to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
To be able to use these you need to create an object instance of Player prefs then call the get/set extention methods. | |
*/ | |
using UnityEngine; | |
public static class ExtensionMethods | |
{ | |
public static void SetBool(this PlayerPrefs pref, string key, bool value) | |
{ | |
PlayerPrefs.SetInt(key, value ? 1 : 0); | |
} | |
public static bool GetBool(this PlayerPrefs pref, string key) | |
{ | |
return PlayerPrefs.GetInt(key) == 1; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment