Page 1 of 1

Trouble with save data in build setting

Posted: Tue Sep 19, 2023 8:42 pm
by naruhodo469
When I try to build my project, the data from my previous build is still there. Is there any way to delete old data? Currently I'm using the visual novel framework's save system. Thanks.

Re: Trouble with save data in build setting

Posted: Tue Sep 19, 2023 9:02 pm
by Tony Li
Hi,

Players generally don't want to lose their saved games when updating to a newer build.

The visual novel framework's save system is the regular Dialogue System save system.

If you want to delete old saved games, there are two ways:

1. To delete all saved games, you can use a SaveSystemMethods component's DeleteSavedGameInSlot method, or C# code such as:

Code: Select all

for (int i = 0; i < 3; i++) // Assumes you have possible 3 save slots. Otherwise change this value.
{
    PixelCrushers.SaveSystem.DeleteSavedGameInSlot(i);
}
2. Or, to delete only old saved games made before the current build, do this: The Dialogue Manager GameObject has a Save System component. The Save System component has a Version value. This value defaults to 0. The Version value is saved with each saved game. Set the Save System component's Version value to a higher number (e.g., change it from 0 to 1) before making them build. When you start the game, run a C# method that checks all save slots. If a save slot has a saved game that has an older Version number, delete it. Example:

Code: Select all

for (int i = 0; i < 3; i++)
{
    var savedGameData = SaveSystem.storer.RetrieveSavedGameData(i);
    if (savedGameData.version < SaveSystem.version)
    {
        SaveSystem.DeleteSavedGameInSlot(i);
    }
}