Page 1 of 1

Reset all variables

Posted: Sun Jun 30, 2024 2:04 am
by DumplingQ
Hello, I have a bunch of variables and quests set in my dialogue database and now I want to reset these variables to their default values when the player presses "reset", what should I do? :shock:

Re: Reset all variables

Posted: Sun Jun 30, 2024 9:10 am
by Tony Li
Hi,

Use this line of C#:

Code: Select all

PixelCrushers.DialogueSystem.DialogueManager.ResetDatabase();
Or, if you're using the Save System:

Code: Select all

PixelCrushers.SaveSystem.ResetGameState();
which automatically calls DialogueManager.ResetDatabase() (assuming your Dialogue Manager has a DialogueSystemSaver component).

If you don't want to write any code, you can add a SaveSystemMethods component to a UI Button and configure its OnClick() event call SaveSystemMethods.ResetGameGame.