public void NewGame() { GameSaveClass temp = new GameSaveClass(); GameSaveData.GiveFromGameSave(temp); SceneManager.LoadScene("scene1"); }
public static void LoadTheGame(string path) { if (File.Exists(path)) { BinaryFormatter form = new BinaryFormatter(); FileStream stream = new FileStream(path, FileMode.Open); GameSaveClass c = form.Deserialize(stream) as GameSaveClass; stream.Close(); GameSaveData.GiveFromGameSave(c); SceneManager.LoadScene("scene1"); } else { path = Application.persistentDataPath + "/SavedGames/try.gm"; BinaryFormatter form = new BinaryFormatter(); FileStream stream = new FileStream(path, FileMode.Open); GameSaveClass c = form.Deserialize(stream) as GameSaveClass; stream.Close(); GameSaveData.GiveFromGameSave(c); SceneManager.LoadScene("scene1"); } }