I am using unity 3.5 on windows 7 and coding in C#… I am following a tutorial on Youtube but the guy on there is using an older version of unity and he is on a mac.
the problem I am getting is in this code… (will explain afterwards):
public void SaveCharacterData () {
GameObject pc = GameObject.Find("Player Character");
PlayerCharacter pcClass = pc.GetComponent<PlayerCharacter>();
PlayerPrefs.DeleteAll();
PlayerPrefs.SetString("Player Name", pcClass.PlayerName);
for(int cnt = 0; cnt < Enum.GetValues(typeof(AttributeName)).Length; cnt++) {
PlayerPrefs.SetInt(((AttributeName)cnt).ToString()+ " - Base Value", pcClass.GetPrimaryAttributeIndex(cnt).BaseValue);
PlayerPrefs.SetInt(((AttributeName)cnt).ToString() + " - Exp To Level", pcClass.GetPrimaryAttributeIndex(cnt).ExpToLevel);
}
}
On his mac the information is stored in a file in a folder and all the data outputs what he wants it to, whereas on windows it is stored in the registry and I get an appended (underscore)h + 10 random numbers, e.g. “Player Name(underscore)h1637936265”(underscore is not showing up in this editor window).
click here to see a picture of what I get in the registry when I start the game and create my character to save the data.
Is this normal?
and if so can you explain what the numbers are and what use they are? or if I am going about this the wrong way?
If you would like me to create links to all the code units just let me know, I am truly stumped on this one.
thanks in advance
Chris