When PlayerPrefs are saved by key, is the key location saved by string. What i want to know is can another script with a different name use the same key name to save another objects values?
Or can a player Pref key name only be used once like a static var?
When editing and all Keys are deleted, is that just for the opened project? Do the other projects keep there prefs from any prior testing?
player prefs is really wierd things. I would recommend saving to xml, this is a way more handy. The script is at unity wiki
AFAIK, PlayerPrefs uses the same keys for all scripts throughout your project. So one script can save “score”, and another script can pull out that same “score”. So they can only be used once. I don’t know the behaviour of it when it comes to currently open projects in the editor vs built/deployed ones though.
However, PlayerPrefs are stored on a per-user basis. So if you assign PlayerPref values in the editor, I don’t think they’ll carry over to any user’s machine when they try to run your deployed game.
Thanks for the reply’s. I just wrote a cool script using the PlayerPrefsX extended prefs class from the wiki, and it works like a charm. Saving position rotation and velocity, that saves for 25 GameObjects. So to save another 25 i’ll just change names of the keys for a second script and so on.
If i wanted to save the position in an array for an inventory item, so that when loaded it was in the same array slot it was before, what would be a good method for doing so?
I was thinking of extending my Inventory item class to include an int that is adjusted when moved around in the Inv, and reload the inv at startup by checking the int for array pos. Where i would have to save the int in a pref. By using the same int i could check if the item was even in the inv or not.
Is there an easier way?