I’ve just seen an article on PlayerPrefs in the documentation, but I came here to inquire about it a little more.
What do PlayerPrefs actually do, and how easy is it to set them up for your game? We are looking for ways to get the game to save user’s data and progress in our Unity game. Users will be able to play the game via the Unity Web Player, in which case, will I still be able to use PlayerPrefs, or is it only for downloadable games?
PlayerPrefs do not need any setup. Writing values using PlayerPrefs calls works out of the box. The values are stored in some file unique for your application. The name and location of this file depend on the type of build and the platform you’re running on (see the PlayerPrefs docs on the specifics: Unity - Scripting API: PlayerPrefs).
For web games there may be a limit to the amount of data you can store.
PlayerPrefs store integers, float or string values on the user’s device. The way you use it is by creating a key for each stored value that you use to retrieve the data. It’s very simple to use, although if you have a lot of data to store, make sure you come up with a clever naming system for the keys or you can use this to save arrays: http://www.unifycommunity.com/wiki/index.php?title=ArrayPrefs
For the webplayer, you can save up to 1 Mb on the local machine. However, you may also want to consider saving data remotely if you want the user to be able to play from any machine using his own preferences/saved games.
Storing data remotely requires that you setup a user identifying system in your game (login, password), set up a database on your server and have server code such as a php script that you can invoke in Unity using the WWW class to interface with the database. You may need to add some security to this to make sure data received by the server comes from the game to prevent cheating. It is a lot more complex than using the Playerprefs, but I’m sure there are some examples and tutorials on the Web that will show you how to achieve this.