public void saveData(GameSaveObject gameSaveObject) { string folderPath = Path.Combine(Application.persistentDataPath, dataFolderName); string dataPath = Path.Combine(folderPath, dataSaveName + fileExtension); BinaryFormatter binaryFormatter = new BinaryFormatter(); using (FileStream fileStream = File.Open(dataPath, FileMode.Create)) { binaryFormatter.Serialize(fileStream, gameSaveObject); } }
public void saveData() { var gameSaveObject = new GameSaveObject(ResearchController.instance.getResearchTreeRoot().getResearchedItemsNames(), xp); SaveController.instance.saveData(gameSaveObject); }