Saving with PlayerPrefs and having multiple character slots?

I'm using PlayerPrefs to save my character, as for now it can only save one character, once you create a new character the old characters stats are replaced by the new ones.

I would like to have the characters to be saved to an empty "slot" when created (or to its own slot if we've loaded an old character) but I have no idea how to do this. I'ld appreciate if someone had the time to show me how this could be done. :)

This is from the script used for saving & loading characters:

public void SaveCharacterData() {
    GameObject pc = GameObject.Find("pc");

    PlayerCharacter pcClass = pc.GetComponent<PlayerCharacter>();
    PlayerPrefs.SetString("Player Name", pcClass.Name);

    for(int cnt = 0; cnt < Enum.GetValues(typeof(AttributeName)).Length; cnt++) {
        PlayerPrefs.SetInt(((AttributeName)cnt).ToString() + " - Base Value",  pcClass.GetPrimaryAttribute(cnt).BaseValue);
        PlayerPrefs.SetInt(((AttributeName)cnt).ToString() + " - Exp To Level",  pcClass.GetPrimaryAttribute(cnt).ExpToLevel);
    }

    for(int cnt = 0; cnt < Enum.GetValues(typeof(VitalName)).Length; cnt++) {
        PlayerPrefs.SetInt(((VitalName)cnt).ToString() + " - Base Value",  pcClass.GetVital(cnt).BaseValue);
        PlayerPrefs.SetInt(((VitalName)cnt).ToString() + " - Cur Value",  pcClass.GetVital(cnt).CurValue);
        PlayerPrefs.SetInt(((VitalName)cnt).ToString() + " - Exp To Level",  pcClass.GetVital(cnt).ExpToLevel); 
    }

    for(int cnt = 0; cnt < Enum.GetValues(typeof(SkillName)).Length; cnt++) {
        PlayerPrefs.SetInt(((SkillName)cnt).ToString() + " - Base Value",  pcClass.GetSkill(cnt).BaseValue);
        PlayerPrefs.SetInt(((SkillName)cnt).ToString() + " - Exp To Level",  pcClass.GetSkill(cnt).ExpToLevel);         
    }
}
public void LoadCharacterData() {
    GameObject pc = GameObject.Find("pc");

    PlayerCharacter pcClass = pc.GetComponent<PlayerCharacter>();

    pcClass.Name = PlayerPrefs.GetString("Player Name", "Name Me");

    for(int cnt = 0; cnt < Enum.GetValues(typeof(AttributeName)).Length; cnt++) {
        pcClass.GetPrimaryAttribute(cnt).BaseValue = PlayerPrefs.GetInt(((AttributeName)cnt).ToString() + " - Base Value",  0);
        pcClass.GetPrimaryAttribute(cnt).ExpToLevel = PlayerPrefs.GetInt(((AttributeName)cnt).ToString() + " - Exp To Level", Attribute.STARTING_EXP_COST);
    }

    for(int cnt = 0; cnt < Enum.GetValues(typeof(VitalName)).Length; cnt++) {
        pcClass.GetVital(cnt).BaseValue = PlayerPrefs.GetInt(((VitalName)cnt).ToString() + " - Base Value",  0);
        pcClass.GetVital(cnt).ExpToLevel = PlayerPrefs.GetInt(((VitalName)cnt).ToString() + " - Exp To Level", 0);

        //make sure you call this so that the AdjustedBaseValue will be updated before you try to call to get the curValue
        pcClass.GetVital(cnt).Update();

        //get the stored value for the curValue for each vital
        pcClass.GetVital(cnt).CurValue = PlayerPrefs.GetInt(((VitalName)cnt).ToString() + " - Cur Value", 1);
    }   

    for(int cnt = 0; cnt < Enum.GetValues(typeof(SkillName)).Length; cnt++) {
        pcClass.GetSkill(cnt).BaseValue = PlayerPrefs.GetInt(((SkillName)cnt).ToString() + " - Base Value",  0);
        pcClass.GetSkill(cnt).ExpToLevel = PlayerPrefs.GetInt(((SkillName)cnt).ToString() + " - Exp To Level",  0);

    }

    //output the curValue for each of the vitals
    for(int cnt = 0; cnt < Enum.GetValues(typeof(SkillName)).Length; cnt++) {
    }
}

I would have a static/global integer var called something like saveId, and have a GUI at the beginning of the game that lets the player select a save slot. So if the user selected save slot 1, it would set saveId to 1... then whenever you save/load any playerprefs, append saveId to the end of the PlayerPref key name (eg: PlayerPrefs.SetInt("PlayerLevel"+saveId, 1) or something).

store the players in an array, Erich5h5 made a very handy script for that http://www.unifycommunity.com/wiki/index.php?title=ArrayPrefs

the values are stored in registry if you're using windows, I'm still not sure about the performance as I only used this script once.

I think your creating a PlayerPref variable called "Player Name" instead of the player's name. So when you create another character you are replacing the value for the variable "Player Name"

Try to call back the name of the PlayerPref to see if this is the case.

One of the ways I would solve this problem is by using JSON.

Store all your per-user data in a json table, and then save that string to a playerprefs key by the user name.