I'm building a top-down tron-style game, and after you finish a gamemode, an arcady 3 letter name input pops up, these go through the alphabet and some numbers. After you input your name, it checks if the name is already in playerprefs and it adds one point to that score. So far so good.
I was ready to start retrieving the data so i could build something like a leaderboard system in another scene, but then I quickly learned that it is not possible to iterate through all playerprefs to retrieve them. I have tried a couple of ways to resolve this problem but it all ended in me having to have the name that the user has inputted to retrieve the associated score.
Now this may sound like a newbie question (and it kinda is, this is my first unity project), but how would one resolve this problem. I have read bits and pieces about serialisation, but it is still very unclear what that actually is and how I could use it for my project
Just for reference, this is the code I use to store my data right now,
void saveData()
{
string nameRes = A.text + B.text + C.text;
int score = PlayerPrefs.GetInt(nameRes);
scoresafe++;
if (scoresafe == 1)
{
score++;
}
else
{
SceneManager.LoadScene("MainMenu");
}
Debug.Log("totalscore:" + score + " scoresafesystem: " + scoresafe);
PlayerPrefs.SetInt(nameRes, score);
PlayerPrefs.Save();
}
Any help would be much appreciated