Make the Saver ignore saving

Announcements, support questions, and discussion for the Dialogue System.
Post Reply
bananavic
Posts: 4
Joined: Thu Jun 13, 2024 5:42 am

Make the Saver ignore saving

Post by bananavic »

Hello Tony,

Thank you for the awesome Dialogue System for Unity!

I have a question regarding the save system.

In my project, I'm converting images into JSON format and saving them using a Saver in Dialogue System for Unity. Since saving images is causing performance hiccups, I plan to make the Saver ignore the part responsible for saving images, and only allow the Photo Saver to execute RecordData when necessary.

I tried adding a variable as a gate in the Photo Saver's RecordData, or adding logic to skip the Photo Saver, but I noticed that the previously saved data gets overwritten and becomes empty. I suspect that when the Saver executes the save operation, it clears all the data before calling every Saver's RecordData. If that's the case, is there a way to achieve what I need?

Thanks for your help!
User avatar
Tony Li
Posts: 22107
Joined: Thu Jul 18, 2013 1:27 pm

Re: Make the Saver ignore saving

Post by Tony Li »

Hi,

What if you just return the existing save data in this case? For example:

Code: Select all

public override string RecordData()
{
    if (convertToJson)
    {
        return ConvertImageToJson();
    }
    else
    {
        return SaveSystem.currentSavedGameData.GetData(key);
    }
}
bananavic
Posts: 4
Joined: Thu Jun 13, 2024 5:42 am

Re: Make the Saver ignore saving

Post by bananavic »

Thank you for your reply. In the end, I chose to use the File API to save the images separately to the hard disk. I hadn't considered that your method could achieve the goal so effectively and simply. I will give it a try later. Thank you again for your help!
Post Reply