void LoadHiScore() { if (File.Exists(Application.persistentDataPath + "/" + "gradius.sav")) { FileStream fs = File.Open(Application.persistentDataPath + "/" + "gradius.sav", FileMode.Open); BinaryFormatter bf = new BinaryFormatter(); GradiusSave sav = (GradiusSave)bf.Deserialize(fs); hiscore = sav.hiscore; UIManager.instance.OnHiScoreChanged(hiscore); } }
void loadHighScore() { if (File.Exists(Application.persistentDataPath + "/" + "gradius.sav")) { FileStream fs = File.Open(Application.persistentDataPath + "/" + "gradius.sav", FileMode.Open); BinaryFormatter bf = new BinaryFormatter(); GradiusSave sav = (GradiusSave)bf.Deserialize(fs); highscore = sav.hiscore; fs.Close(); } }
void SaveHiScore() { GradiusSave save = new GradiusSave(); save.hiscore = hiscore; FileStream fs = File.Create(Application.persistentDataPath + "/" + "gradius.sav"); BinaryFormatter bf = new BinaryFormatter(); bf.Serialize(fs, save); fs.Close(); }