Show / Hide Table of Contents

    Backup the Data

    You can create a new backup from the saved data by using the SaveSystemAPI.CreateBackupAsync and then restore the latest backup by calling the SaveSystemAPI.RestoreLatestBackupAsync method or restore a specific backup by using the SaveSystemAPI.RestoreBackupAsync.

    Learn more about the Backup feature >

    Creating and Restoring a Backup

    async void Start() {
    
        // The identifier of the saved data to create a backup for.
        string identifier = "name.json";
    
        // A sample data to demonstrate the before / after of restoring a backup
        string data = "The sample data";
    
        // Saving a sample data
        await SaveSystemAPI.SaveAsync(identifier, data);
    
        // Create a new backup
        await SaveSystemAPI.CreateBackupAsync(identifier);
    
        // Modifying the data and saving it again to have a different version than of the backup
        data = "New Data!";
        await SaveSystemAPI.SaveAsync(identifier, data);
    
        // And then restore the backup
        await SaveSystemAPI.RestoreLatestBackupAsync(identifier);
    
        // Now, load the data to see the result
        data = await SaveSystemAPI.LoadAsync<string>(identifier);
    
        Debug.Log(data); // Outputs "The sample data"
    }
    
    • Improve this Doc
    • 0 Comments