// This previews the contents of the savefile public void PreviewSave(string filename = "_autosave") { // Strings for the save directory and savefile string savePath = Application.dataPath + "/Saves"; string saveName = savePath + "/" + filename + ".txt"; // Sanity check: if the filename is "", assume it's "_autosave" if (filename == "") { saveName = savePath + "/_autosave.txt"; } // Try to open the file and preview its contents try { string saveString = File.ReadAllText(saveName); Savedata s = JsonConvert.DeserializeObject <Savedata>(saveString); string previewText = "Savefile: " + filename + "\n" + "City Funds: " + s.financialData + "\n" + "Game time: " + Timekeeper.SimpleDate(s.gameTime, 2000); ; _textSavefilePreview.text = previewText; } catch (FileNotFoundException) { _textSavefilePreview.text = "No data saved in slot to preview."; Debug.Log("[GameLoop]: Failed to find save for previewing."); } }