private static FilePrefsData GetSaveFile() { CheckSaveFileExists(); if (latestData == null) { var saveFileText = File.ReadAllText(GetSaveFilePath()); if (scrambleData) { saveFileText = DataScrambler(saveFileText); } try { latestData = JsonUtility.FromJson <FilePrefsData>(saveFileText); } catch (ArgumentException e) { Debug.LogException(new Exception("SAVE FILE IN WRONG FORMAT, CREATING NEW SAVE FILE : " + e.Message)); DeleteAll(); } } return(latestData); }
public static void OverwriteLocalSaveFile(string data) { WriteToSaveFile(data); latestData = null; }
public static void DeleteAll() { WriteToSaveFile(JsonUtility.ToJson(new FilePrefsData())); latestData = new FilePrefsData(); }