Writing Changes
Officially saving the data.
Saving, Loading, and Deleting, only edit the save data in memory. The changes aren't officially saved until the Save method is called.
saveFile.Save();Why Is It Like This?
There are 2 reasons as to why the data management methods don't automatically call Save:
The
Savemethod writes data directly to a file on the user's system—a process that can be time-consuming, especially with large amounts of data. IfSavewas called automatically every timeAddOrUpdateDataorDeleteDatawas used, it would affect performance.You can give players control over when their data is officially saved—for example, by letting them manually save through a dedicated save menu. This approach allows
AddOrUpdateDataandDeleteDatato be used frequently during gameplay to modify player data while reservingSavefor moments when the data needs to be officially written into the save file.
Last updated