Saving a bool

I know how to save INT, Floats, and strings, by useing PlayerPrefs. But what is the best way to save a bool?

You can save “0” for false and “1” for true.

There’s also something on the UnifyWiki:
http://wiki.unity3d.com/index.php?title=BoolPrefs

To expand a bit, you can also store it as a string.

bool someValue = true;

string stringValue = someValue.ToString();

bool newValue;

bool.TryParse(stringValue, out newValue);

Saving as an int will save space. If you want to save it that way you can do this:

bool someValue = true;

int savedValue = Convert.ToInt32(someValue);

bool retrievedValue = Convert.ToBoolean(savedValue);

Using Convert.ToBoolean with an “int” will turn any non-zero int into “true” and 0 will always be “false”.