How to save a progress by user with diferent users

I have a problem I need to have a login System of users , but I can´t relate the Player.Prefs with the screen that display the list of player registered and new users … someone that had make somthing like that ?? I need to save the progress of each user…


You could add the user name or code to the key when saving and restoring its value. If you want to save the score, for instance:

// save the score:
PlayerPrefs.SetFloat(username+".Score", score);

// retrieve the score:
score = PlayerPrefs.GetFloat(username+".Score", 0);

EDITED: You can save multiple users data this way:

1- Save the usernames with keys like “User”+num. To retrieve all registered users, do something like this:

var numUsers = PlayerPrefs.GetInt("NumUsers", 0); // how many registered users?
var usernames = new String[numUsers+1]; // create the user name array...
for (var n = 1; n <= numUsers; n++){
  usernames[n] = PlayerPrefs.GetString("User"+n, ""); // and load them

2- Show a GUI menu with the users, and let the player select his user name or code;

3- Use the user name or code to find all other user info you need (health, points, weapons, position etc.), always using keys composed by the user name or code plus the info name, like this:

  health = PlayerPrefs.GetFloat(username+".Health", 100);
  points = PlayerPrefs.GetInt(username+".Points", 0);
  hasShotgun = PlayerPrefs.GetInt(username+".Shotgun", 0);
  hasMachinegun = PlayerPrefs.GetInt(username+".MachineGun", 0);

Obviously, you must save the data with the same format. When an user is registered, for instance, save its data like this:

var numUser = PlayerPrefs.GetInt("NumUsers", 0);
numUser += 1; // count this user
PlayerPrefs.SetInt("NumUsers", numUser); // update users count
PlayerPrefs.SetString("User"+numUser, username);

Best way to storing data is Binary Files. Bcoz it is most secure, as data store in terms of zeros and ones.

For more information, go through this link:

I hope it helps.