I'm now making it so players make an account and log in to play, and I'm saving their data on the online PlayFab backend servers. I'll be able to figure out how to save almost everything, except I don't know how to save the Quest States because that's done automatically via the Dialogue System Saver component.
A short version of my Saver script that I got from a tutorial on this website:
Code: Select all
public override string RecordData()
{
var data = new SaveData();
data.currentHealth = GetComponent<PlayerHealth>().currentHealth;
return SaveSystem.Serialize(data);
}
public override void ApplyData(string s)
{
if (string.IsNullOrEmpty(s)) return; // If we didn't receive any save data, exit immediately.
var data = SaveSystem.Deserialize<SaveData>(s);
if (data == null) return;
Debug.Log($"Restoring currentHealth={data.currentHealth}");
GetComponent<PlayerHealth>().healthBar.SetHealth(data.currentHealth);
}