// Applies all options from the saved file to the locally created variables. public static void Load() { // Make sure all the strings for conversations are loaded. ConversationsDB.LoadConversationsFromFiles(); if (File.Exists(WhereIsData())) { // Prepare for data IO. BinaryFormatter bf = new BinaryFormatter(); FileStream file = File.Open(WhereIsData(), FileMode.Open); // Deserialize the data. SaveContainer data = (SaveContainer)bf.Deserialize(file); file.Close(); //! Fields go here. ConversationTrigger.tokens = new HashSet <string>(data.tokens); // Read inventory-related tokens. InventoryController.ConvertTokensToInventory(); BatterySystem.TokensToPower(); Debug.Log("Loaded all options successfully."); } else { // No file exists? We should make the default one! Debug.Log("No save found, creating default file."); Save(); } }