So the issue is the spawned prefab does not have the recorded data, and they can't retrieve it immediately upon scene load because there is loading time for finding the server.
Is there a way to call the ApplyData method from the Saver script in a Start function on the player?
I try to use "GetComponent<PlayerStats>().ApplyData(s)" but it tells me s doesn't exist in the current context. What else would be the parameter? Can methods be called from Saver scripts?
Here is a short portion of the Apply Data function in my Saver script (just without every single int that's being saved as a string),
Code: Select all
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;
GetComponent<PlayerAttack>().damage = data.damage;