How do I restore all Settings to default when I return to the main menu?

Announcements, support questions, and discussion for the Dialogue System.
Post Reply
hhyu
Posts: 12
Joined: Fri Jul 05, 2024 9:31 am

How do I restore all Settings to default when I return to the main menu?

Post by hhyu »

I am currently using both the Dialogue System and Quest Machine. When saving, I use:

gameSaveData.DialogueData = PersistentDataManager.GetSaveData();
gameSaveData.QuestDataDict = SaveSystem.Serialize(SaveSystem.RecordSavedGameData());

When loading, I use:

PersistentDataManager.ApplySaveData(gameSaveData.DialogueData);
SaveSystem.ApplySavedGameData(SaveSystem.Deserialize<SavedGameData>(gameSaveData.QuestDataDict));

However, there's an issue: when returning to the main menu, I need to reset both components to their default states. Otherwise, when starting a new game again, the old data persists and contaminates the new game session.
User avatar
Tony Li
Posts: 22655
Joined: Thu Jul 18, 2013 1:27 pm

Re: How do I restore all Settings to default when I return to the main menu?

Post by Tony Li »

Hi,

Call PixelCrushers.SaveSystem.ResetGameState(). This will reset all saver data to default.
Post Reply