Insert it in your class as a helper class, and you could handle booleans with it.
class PlayerPrefsExtension { public static void SetBool(string name, bool booleanValue) { PlayerPrefs.SetInt(name, booleanValue ? 1 : 0); } public static bool GetBool(string name) { return PlayerPrefs.GetInt(name) == 1; } }
Here is an example:
public static void UnlockLevel(int level) { if (level < SceneManager.sceneCountInBuildSettings) { PlayerPrefsExtension.SetBool(LEVEL_KEY + level.ToString(), true); } Debug.LogError("Tried to unlock a level not in the build settings!"); }