> For the complete documentation index, see [llms.txt](https://obvious-game.gitbook.io/soap/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://obvious-game.gitbook.io/soap/scene-documentation/5_scriptablesaves/save-version.md).

# Save Version

5\_ScriptableSave

You might have noticed that I added a Version int in the SaveData. This is an example, but it's a great way to detect if a save file is from an older version.

<figure><img src="https://1391552916-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FWqhD9b0UbiZjyC9B8azX%2Fuploads%2FJrFpV4SmlH9HSkv9Hx0m%2F15.png?alt=media" alt="" width="563"><figcaption></figcaption></figure>

For developers who have worked on live games, when you add a new feature or refactor some elements, the save data structure might change. In these cases, you need to upgrade the old data structure to the new one. Scriptable Save provides two methods that you can override to suit your needs:

```csharp
protected override void UpgradeData(SaveData oldData)
{
    if (_debugLogEnabled)
        Debug.Log("Upgrading data from version " + oldData.Version + " to " + _saveData.Version);
    // Implement additional upgrade logic here
    oldData.Version = _saveData.Version;
}

protected override bool NeedsUpgrade(SaveData saveData)
{
    return saveData.Version < _saveData.Version;
}
```
