online save preview

Most games using id.net saves should provide guests with a way to save their progress. To do this, show players 2 options as shown above.

If the player is not logged in to id.net (ex. Idnet.User.LoggedIn() == false) and clicks on the Online Save button, then open the login menu.

If the player is logged in already and chooses online saves, then get their data from the server using the Get Api (Login Api callback) and save to a variable or playerprefs. Also, display the player’s name to show them they are logged in.

If a guest chooses offline saves, just load the game normally and skip the get api.

Online Saves

// Set Current Mode of user.
Idnet.I.CurrentMode = Idnet.GameMode.OnlineSave;

if(!Idnet.User.LoggedIn())
{
   Idnet.I.LoginRegister(loginRegisterException => {
   if (Idnet.User.LoggedIn())
   {
      // Callback: Login/Register Successfull. 
      Debug.Log("User logged in: " + "Nickname " + Idnet.User.Current.Nickname);
      // Get user's progress,store to playerprefs and hence load level.
      OnlineSaveGetDataExample();
   }
 });
}
else
{
   // User already logged-in,Get user's progress,store to playerprefs and hence load level.
   OnlineSaveGetDataExample();
}

Offline Saves

//Set Current Mode of user.
Idnet.I.CurrentMode = Idnet.GameMode.LocalSave;
// Play the game normally,just load the gameplay level here.
// Make sure,you dont use Post API when user selected Local Save.