Page 1 of 1

Make the Saver ignore saving

Posted: Sat Sep 14, 2024 1:27 am
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!

Re: Make the Saver ignore saving

Posted: Sat Sep 14, 2024 8:22 am
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);
    }
}

Re: Make the Saver ignore saving

Posted: Sat Sep 14, 2024 12:55 pm
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!