SMAPI - Stardew Modding API

SMAPI - Stardew Modding API

971k Downloads

Request: ClearSaveData(string key)

jtgibson01 opened this issue ยท 1 comments

commented

Short and sweet: currently there is a WriteSaveData serialiser that records data from a class into the game save, and a ReadSaveData deserialiser that loads data from the game save into a class, but there is no way to remove save data from the save file entirely to clear bloat. I would prefer if there were a method.


I apologise for making the suggestion here, contrary to the Feature Request issue template notice, but I do not use Discord or Reddit by intention. Feel free to close if this offends anyone's sensibilities. =)

commented

Hi! You can pass a null model into the Write* methods to delete the entry:

helper.Data.WriteSaveData<ModData>("your key", null);

Seems that wasn't actually documented though, so I fixed the docs in the upcoming SMAPI 3.13.0. Thanks for bringing it up!