> For the complete documentation index, see [llms.txt](https://apex-studio.gitbook.io/apex-secure-vault-official-documentation./llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://apex-studio.gitbook.io/apex-secure-vault-official-documentation./advanced-features.md).

# Advanced Features

For large-scale and continuously updated games, basic saving is not enough. Apex Secure Vault provides built-in mechanisms to handle complex scenarios like game updates and multiple user profiles.

#### Step 8.1: Save Data Migration (Handling Version Updates)

When you release a new update for your game (e.g., from v1.0.0 to v1.1.0), you might add new variables or change how certain data works. Apex Secure Vault automatically records the Application.version inside every encrypted save file.

If a player downloads your update and loads their old save file, the engine detects the version mismatch. You can catch this event and safely convert or reward the player using the ISaveMigration interface.

```csharp
using UnityEngine;
using ApexStudio.ApexSecureVault;

public class PlayerInventory : SaveableObject, ISaveMigration
{
    [SaveState] public int gold = 100;
    // Let's say this is a new variable added in v1.1.0
    [SaveState] public int diamonds = 0; 

    // This method is triggered automatically if the save file's version 
    // is older than the current Application.version
    public void OnMigrate(string savedVersion, string currentVersion)
    {
        Debug.Log($"Upgrading save file from {savedVersion} to {currentVersion}");
        if (savedVersion == "1.0.0")
        {
            // Give players from the older version a bonus for updating!
            diamonds += 50; 
            Debug.Log("Migration Complete: Awarded 50 Diamonds to veteran player!");
        }
    }
}

```

#### Step 8.2: Multiple Save Profiles (Save Slots)

Many games require multiple "Save Slots" so different players can play on the same device, or a single player can have multiple playthroughs.

Apex Secure Vault handles this natively via "Profiles". Instead of saving everything to the default vault, you can simply pass a profile name to the API. The engine will automatically create isolated, secure folders for each profile.

```csharp
using UnityEngine;
using ApexStudio.ApexSecureVault;

public class ProfileManager : MonoBehaviour
{
    public void SaveToSlot1()
    {
        // Saves all data into an isolated folder named "SaveSlot_01"
        SaveStateEngine.SaveAll("SaveSlot_01");
    }

    public void LoadFromSlot2()
    {
        // Loads data strictly from "SaveSlot_02"
        SaveStateEngine.LoadAll("SaveSlot_02");
    }

    public async void AsyncSaveToSlot3()
    {
        // Background thread saving into "SaveSlot_03"
        await SaveStateEngine.SaveAllAsync("SaveSlot_03");
    }
}

```


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://apex-studio.gitbook.io/apex-secure-vault-official-documentation./advanced-features.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
