I’ve tried saving score using playerprefs and displaying it on the highscore screen, but now what i’m looking for is saving the scores in a list/array using playerprefsX, is someone here can help me out with that ? shall be very thankfull for the support.,
How to save scores in an array using playerprefsx ?,How to save highscore array using playerprefsX ?
You can gather all the scores in a single string, like :
public List<int> scores;
void Start()
{
string scoreString;
foreach (int score in scores)
scoreString += score.ToString() + ";";
PlayerPrefs.SetString("Scores", scoreString);
scoreString = PlayerPrefs.GetString("Scores");
scores = new List<int>();
string [] splitter = new string[] {";"};
List<string> scoreStrings = new List<string> (scoreString.Split (splitter));
foreach (string s in scoreStrings)
scores.Add (int.Parse(s));
}