Page 1 of 1

Save System and PlayMaker

Posted: Tue Apr 26, 2022 8:58 am
by Tony Li
(Posting for a Dialogue System user.) This is a reply to a question about setting up the save system and PlayMaker.

This is a typical setup:

In the main menu scene:

1. Set up the Dialogue Manager GameObject with the SaveSystem, JsonDataStorer, PlayerPrefsSavedGameDataStorer, DialogueSystemSaver, and PlayMakerGlobalVariableSaver.

2. Add a SaveSystemMethods component to your "New Game" button. Configure the button's OnClick() to call SaveSystemMethods.RestartGame, and specify the first gameplay scene.

3. Add a SaveSystemMethods component to your "Load Game"/"Continue" button. Set its Default Starting Scene Name to the name of the first gameplay scene. Configure OnClick() to call SaveSystemMethods.LoadOrRestart, and specify a saved game slot number.


In your gameplay scene(s):

1. Add a Dialogue System Trigger and SaveSystemMethods component to a GameObject. Set the Dialogue System Trigger to OnSaveDataApplied. Select Add Action > OnExecute() Event. Configure the OnExecute() event to call SaveSystemMethods.SaveSlot, and specify the same saved game slot number.

Re: Save System and PlayMaker

Posted: Tue Apr 26, 2022 9:14 pm
by Tony Li
A question came up about scene changes.

The Dialogue Manager survives scene changes. Make sure not to connect other scene objects to the Dialogue Manager since the connection will be broken when the scene changes. For example, don't do this:

no.png
no.png (46.31 KiB) Viewed 268 times

Do this instead:

yes.png
yes.png (51.74 KiB) Viewed 268 times

Notice that the continue button in the first screenshot has a direct reference to the Dialogue Manager. But this will change when you change scenes, so don't do it. Instead, set it up like the second screenshot.