Create a list of all PlayPref Keys

Hi there, basically we’ve created a character creator system that used PlayerPref keys to store the character configuration. I want to create a character select screen but using all the string names of each of the saved characters names. Is there a way I can create a array from all the PlayerPref keys?

+1 good question.

I would also like the answer to this. This would be my first approach but seams like a headache.

Instead of storing it by name, I would store them by number, and every piece of equipment also. So Hat might be stored in 1, boots in 2 and so on. Then the type of boots would also be a number like black is 1 and blue is 2. Lost yet? Then the first stored character could look like this:

PlayerPrefs.SetString(“1”,“0202”);

Then you could write an algorithm that decodes that the first 2 indexes in the string tell you what kind of hat he/she has on and the second 2 indexses tell you what kind of boots he/she has on. Blue Blue. That would allow you to store lots of characters and their setups without storing thousands of variables.

And Storing it by number would allow you to sweep through it using a for loop.

function CheckForCharacter(){
for(var i=0; i<1000; i++)
{
if(PlayerPrefs.HasKey(i))
{
do something
}
else
{
return;
}
} 
}

What do you think?

I use ArrayPrefs. You can load the prefs as an array and save the prefs as an array directly.