Using the Save Storage

Scripting with the SaveStorage class.

When scripting with the Save Storage, ensure that there is a Save Storage component in your scene.

The purpose of the save storage is simpleโ€”it helps find saves by storing their file path. Read more about this here.

Adding to the Storage

Save files that have addToStorage set to true will automatically be added to the save storage. Ensure that there is a Save Storage component in your scene. You can also add the save file to the storage with the code below.

// Where save is a SaveFile reference
SaveStorage.instance.AddSave(save);

Removing From the Storage

Removing saves from the storage is useful when you'd like the player to have the option to delete a save state.

// Where save is a SaveFile reference
SaveStorage.instance.RemoveSave(save);

Accessing the Saves

Get All Saves

You can get the list of all saves with the code below.

var allSaves = SaveStorage.instance.saves;

Get a Save By File Name

var save = SaveStorage.instance.GetSaveByFileName("name");

Last updated