public static SaveData LoadFromDisk() { if (!IsSaveDataAvailableAtDisk()) { return(RecreateDataOnDisk()); } try { SaveData saveData = Load(); if (!saveData.Validate()) { saveData.Save(); // reload and construct again from disk return(Load()); } else { return(saveData); } } catch (Exception e) { Debug.LogError("Failed to deserialize AssetBundleGraph settings. Error:" + e + " File:" + SaveDataPath); } return(new SaveData()); }
public static SaveData RecreateDataOnDisk() { SaveData newSaveData = new SaveData(); newSaveData.Save(); return(newSaveData); }