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:

  1. The Save method writes data directly to a file on the user's system—a process that can be time-consuming, especially with large amounts of data. If Save was called automatically every time AddOrUpdateData or DeleteData was used, it would affect performance.

  2. 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 AddOrUpdateData and DeleteData to be used frequently during gameplay to modify player data while reserving Save for moments when the data needs to be officially written into the save file.

Last updated