private Highscore LoadScore(string name, int level) { level++; var serializer = new XmlSerializer(typeof(ByteSave)); using (var stream = new FileStream(Application.persistentDataPath + "/Level" + level.ToString() + "/SavedGame_" + name + ".xml", FileMode.Open)) { ByteSave save = serializer.Deserialize(stream) as ByteSave; Highscore score = (Highscore)ByteArrayToObject(save.save); return(score); } }
private void SaveScore(Highscore tS, string name, int level, int lastLevel) { level++; tS.level = lastLevel; ByteSave toSave = new ByteSave(); toSave.save = ObjectToByteArray(tS); var serializer = new XmlSerializer(typeof(ByteSave)); using (var stream = new FileStream(Application.persistentDataPath + "/Level" + level.ToString() + "/SavedGame_" + name + ".xml", FileMode.Create)) { serializer.Serialize(stream, toSave); } }