Hi All,
I would like to save my boolean array to playerprefs not quite sure which is the best way to do it.
I have a boolean array that is lvlcomplete and a level index “value” that is the current scene index.
lvlcomplete[value] its then set to true once the level is completed with the minimum score required.
So how would i then go about saving and retreiving the lvlcomplete boolean array in playprefs.
Sorry for the total ignorance am a newbie.
In this case, I use serializable and JsonUtility. But this is slow.
[System.Serializable]
class BoolArray { public List<bool> bools = new List<bool>(); };
void SaveBoolArray(string key, BoolArray boolArray)
{
var str = JsonUtility.ToJson(boolArray);
PlayerPrefs.SetString(key, str);
}
BoolArray LoadBoolArray(string key)
{
var str = PlayerPrefs.GetString(key);
return JsonUtility.FromJson<BoolArray>(str);
}