public void LoadLoadManager() { LoadManagerData loadManagerData = SaveSystem.LoadLoadManager(); for (int i = 0; i <= loadManagerData.highestLevelUnlocked; i++) { loadManager.levelButtons[i].GetComponent <Button>().interactable = true; loadManager.levelScores[i] = loadManagerData.levelScores[i]; } }
public static void SaveLoadManager(LoadManager loadManager) { BinaryFormatter formatter = new BinaryFormatter(); string path = Application.persistentDataPath + "/loadManager.save"; FileStream stream = new FileStream(path, FileMode.Create); LoadManagerData data = new LoadManagerData(loadManager); formatter.Serialize(stream, data); stream.Close(); }
public static LoadManagerData LoadLoadManager() { string path = Application.persistentDataPath + "/loadManager.save"; if (File.Exists(path)) { BinaryFormatter formatter = new BinaryFormatter(); FileStream stream = new FileStream(path, FileMode.Open); LoadManagerData data = formatter.Deserialize(stream) as LoadManagerData; stream.Close(); return(data); } else { Debug.LogError("No Save File in: " + path); return(null); } }