Save System not working in builds

Announcements, support questions, and discussion for the Dialogue System.
Post Reply
annathehank
Posts: 95
Joined: Sun May 03, 2020 2:17 pm

Save System not working in builds

Post by annathehank »

Hi there <3

I followed the instructions in the manual to set up both the save system in general and the save game method via the save system methods script for buttons.

The thing is, this works perfectly fine when I'm playing the game in the unity editor. But when I build it (currently set to build as a standalone), it doesn't work. I click the save button, but when I go back to the menu and try to load the game nothing happens.

I have it set up with the playerprefs saved game data storer, but do I need to use Disk Save Game Storer if it's a standalone build?
User avatar
Tony Li
Posts: 22037
Joined: Thu Jul 18, 2013 1:27 pm

Re: Save System not working in builds

Post by Tony Li »

Hi,

PlayerPrefs Saved GameData Storer is fine to use. You don't have to switch to Disk Saved Game Data Storer.

Make sure the GameObject with the Save System component is in the first scene that uses any save system functionality. (Your Save System component may be on the Dialogue Manager GameObject or on its own GameObject.)

If you invoke a save system feature when the scene doesn't have a Save System component, it will create a stand-in Save System GameObject that may not have the settings you need. However, it will continue to survive scene changes and replace Save System components in subsequent scenes, which you usually don't want to happen.

Try moving your Save System GameObject to the first scene in build settings.

If that doesn't fix it, make a Development Build. Then reproduce the issue. If the build runs into an error during play, it will report the error onscreen. If it doesn't report and error, feel free to send the Player.log file to tony (at) pixelcrushers.com
annathehank
Posts: 95
Joined: Sun May 03, 2020 2:17 pm

Re: Save System not working in builds

Post by annathehank »

Sorry it took me a while to get to this,

I have the save system set up on the Dialogue Manager in the first scene. I did a developmental build but nothing popped up while I was trying to save/load.

I'm not sure where to find the player.log file. Is it in the development build's folder? I checked through everything in there and didn't see it.
annathehank
Posts: 95
Joined: Sun May 03, 2020 2:17 pm

Re: Save System not working in builds

Post by annathehank »

I notice that when I added the conversation state saver to the dialogue manager, clicking continue started the conversation, but didn't move to the scene, if that helps suss out the issue
User avatar
Tony Li
Posts: 22037
Joined: Thu Jul 18, 2013 1:27 pm

Re: Save System not working in builds

Post by Tony Li »

Is the 'Save Current Scene' checkbox ticked on your Save System component?
annathehank
Posts: 95
Joined: Sun May 03, 2020 2:17 pm

Re: Save System not working in builds

Post by annathehank »

Yep, this is how I have it all set up

Image

And then I have a save and a save&quit button on my quest log window
Image
Image

And then a continue button on the main menu screen
Image
annathehank
Posts: 95
Joined: Sun May 03, 2020 2:17 pm

Re: Save System not working in builds

Post by annathehank »

oh and all the save/continue buttons have the Save System Methods script as well
User avatar
Tony Li
Posts: 22037
Joined: Thu Jul 18, 2013 1:27 pm

Re: Save System not working in builds

Post by Tony Li »

Hi,

On your Save & Quit button, change the OnClick configuration to this:

saveAndQuitButton.png
saveAndQuitButton.png (58.03 KiB) Viewed 1536 times

The save process takes 2 frames. The setup above used a TimedEvent component to wait 2 frames after requesting the save. After 2 frames, the TimedEvent component changes scenes and closes the quest log window.

Also, set unique Key values for the Dialogue System Saver and Conversation State Saver.

If that doesn't help, can you send a reproduction project to tony (at) pixelcrushers.com?
User avatar
Tony Li
Posts: 22037
Joined: Thu Jul 18, 2013 1:27 pm

Re: Save System not working in builds

Post by Tony Li »

Hi,

Thanks for sending the reproduction project. I sent detailed screenshots in a reply email. I'll summarize some items here:

1. Hook up UI Buttons to a SaveSystemMethods component on the Button, not directly to the Dialogue Manager. Since the Dialogue Manager can survive scene changes, it's possible that the UI Button will lose direct references to the Dialogue Manager.

2. When it's possible that the player can continue a saved game into a scene, you generally will not want to start conversations using a Dialogue System Trigger set to OnStart. This is because the saved game may want to resume a conversation. Instead, set the Dialogue System Trigger to OnUse, and add a SaveSystemEvents component whose OnSaveDataApplied() event calls DialogueSystemTrigger.OnUse.
Post Reply