private void SaveData() { if (ProgressData == null) { ProgressData = new PlayerProgressData(); } SaveDataManager.Save(ProgressData, ProgressData.DirectoryPath, ProgressData.FileNamePath); }
private void Awake() { if (Instance == null) { //DontDestroyOnLoad(gameObject); Instance = this; } else if (Instance != this) { Destroy(gameObject); } }
public void Clear() { Debug.Log("Clearing player progress"); var path = System.IO.Path.Combine(Application.persistentDataPath, PlayerProgressFilename); if (File.Exists(path)) { File.Delete(path); } data = new PlayerProgressData(); }
public void Load() { var path = System.IO.Path.Combine(Application.persistentDataPath, PlayerProgressFilename); if (System.IO.File.Exists(path)) { Debug.Log("Loading player progress from: " + path); var json = System.IO.File.ReadAllText(path); data = JsonUtility.FromJson <PlayerProgressData>(json); } else { Debug.Log("Creating new player progress"); data = new PlayerProgressData(); } }
private void LoadData() { ProgressData = SaveDataManager.Load <PlayerProgressData>(ProgressData.DirectoryPath, ProgressData.FileNamePath); }