GameData LoadGame(int saveSlot) { string path = Application.persistentDataPath + Path.DirectorySeparatorChar + "SaveData" + Path.DirectorySeparatorChar + "save" + saveSlot + ".gd"; SaveChainData.Load("chain" + saveSlot); if (File.Exists(path)) { BinaryFormatter bf = new BinaryFormatter(); FileStream file = File.Open(path, FileMode.Open); GameData gd = (GameData)bf.Deserialize(file); file.Close(); coins = gd.totalCoins; keys = gd.totalKeys; return(gd); } return(new GameData()); }
private void OnDisable() { SaveChainData.Load("OriginalChainData"); }