Is it possible to save a boolean?

So I’ve been using PlayerPrefs to save various int and float variables in my game, I was wondering, how do I save and load a boolean with PlayerPrefs? I’m sure I could jury-rig something using an integer if it’s not possible, but I’d rather not have to if I don’t need to.

Thank you for your time.

Erich5h posted this a while back: http://www.unifycommunity.com/wiki/index.php?title=BoolPrefs

Hello there!

To my knowledge there is no way to save a boolean with PlayerPrefs. Juryrigging with an int is what I usually do.

public static void SetBool(string keyName, bool value)
{
    PlayerPrefs.SetInt(keyName, value ? 1 : 0);
}

public static bool GetBool(string keyName)
{
    return (PlayerPrefs.GetInt(keyName) == 1 ? true : false);
}

With those functions you can set and get bools just like you do with PlayerPrefs.

Edit: Well. It seems someone was about 4 seconds faster than me.

Okay, Thanks guys, that’s cleared up my issue.