Save quest state when switch to other scene?

Announcements, support questions, and discussion for Quest Machine.
Post Reply
namdang99
Posts: 12
Joined: Fri Nov 18, 2022 4:46 am

Save quest state when switch to other scene?

Post by namdang99 »

Is there any turtorial to save quest state when switch to other scene?
When my player move to other scene and then comback, the quest is reset.
User avatar
Tony Li
Posts: 22100
Joined: Thu Jul 18, 2013 1:27 pm

Re: Save quest state when switch to other scene?

Post by Tony Li »

Hi,

Use the save system. See "Appendix 2: Save System" in the manual. Or use these steps:

1. Add these components to your Quest Machine GameObject: SaveSystem, JsonDataSerializer, PlayerPrefsSavedGameDataStorer.

2. Inspect your player's QuestJournal component. Tick Save Settings > Include In Saved Games, and set a unique key such as "playerJournal". (The key should be the same for the player's Quest Journal components in all scenes.)

3. Change scene using any of these methods.
namdang99
Posts: 12
Joined: Fri Nov 18, 2022 4:46 am

Re: Save quest state when switch to other scene?

Post by namdang99 »

Thank Tony!
I did it!
Now I want to save quest even if I quit play mode. How can I do?
User avatar
Tony Li
Posts: 22100
Joined: Thu Jul 18, 2013 1:27 pm

Re: Save quest state when switch to other scene?

Post by Tony Li »

Hi,

If you want to save automatically when quitting play mode / exiting the game, add an AutoSaveLoad component to the GameObject, and tick Save On Quit. Leave the other checkboxes UNticked.
Post Reply