Many scripts initialize themselves in Start() methods, and sometimes they take more than one frame to finish initialization. You don't want to apply the saved game data's state until the script has finished initializing; otherwise the initialization process may overwrite the state that you just applied.
You can configure the Save System component to wait any number of frames before applying the saved game data. By default, it waits one frame. If you need to access saved state at start, try setting Frames To Wait Before Apply Data to zero, or tick the saver's Restore On Start checkbox. If that doesn't resolve the issue, you can wait until the save system has applied the save data. To do this, hook into the SaveSystem.saveDataApplied C# event:
Code: Select all
void OnEnable() { PixelCrushers.SaveSystem.saveDataApplied += OnSaveDataApplied; }
void OnDisable() { PixelCrushers.SaveSystem.saveDataApplied -= OnSaveDataApplied; }
void OnSaveDataApplied()
{
// (We know the saved state has been applied, so we can trigger quests, etc., now.)
}