Page 1 of 1
Save System not working in builds
Posted: Sat May 22, 2021 11:45 am
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?
Re: Save System not working in builds
Posted: Sat May 22, 2021 2:24 pm
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
Re: Save System not working in builds
Posted: Thu May 27, 2021 12:03 pm
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.
Re: Save System not working in builds
Posted: Thu May 27, 2021 12:15 pm
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
Re: Save System not working in builds
Posted: Thu May 27, 2021 12:55 pm
by Tony Li
Is the 'Save Current Scene' checkbox ticked on your Save System component?
Re: Save System not working in builds
Posted: Thu May 27, 2021 1:08 pm
by annathehank
Yep, this is how I have it all set up
And then I have a save and a save&quit button on my quest log window
And then a continue button on the main menu screen
Re: Save System not working in builds
Posted: Thu May 27, 2021 1:09 pm
by annathehank
oh and all the save/continue buttons have the Save System Methods script as well
Re: Save System not working in builds
Posted: Thu May 27, 2021 3:31 pm
by Tony Li
Hi,
On your Save & Quit button, change the OnClick configuration to this:
- saveAndQuitButton.png (58.03 KiB) Viewed 1531 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?
Re: Save System not working in builds
Posted: Mon May 31, 2021 2:28 pm
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.