void LoadSavePoint() { BinaryFormatter bf = new BinaryFormatter(); FileStream file = File.Open(Application.dataPath + "/SaveGameAtSavePoint.dat", FileMode.Open); SaveDataFromPlayerStats data = (SaveDataFromPlayerStats)bf.Deserialize(file); file.Close(); loreListFromSave = data.loreList; NewMonsterList = new GameObject[loreListFromSave.Count]; }
public void LoadGameAtSavePoint() { if (File.Exists(Application.dataPath + "/SaveGameAtSavePoint.dat")) { BinaryFormatter bf = new BinaryFormatter(); FileStream file = File.Open(Application.dataPath + "/SaveGameAtSavePoint.dat", FileMode.Open); SaveDataFromPlayerStats data = (SaveDataFromPlayerStats)bf.Deserialize(file); file.Close(); sceneToLoad = data.currentLevel; //get the saved scene; LoadingScreenLogic.sceneName = sceneToLoad; useSaveDataAtSavePoint = true; //set this so that when the scene is loaded use the save file ChangeLevel("LoadingScreen"); } }