> 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./manual-save-and-load-api-reference.md).

# Manual Save & Load (API Reference)

For developers who require absolute control over exact save timings (e.g., saving only at checkpoints or between specific UI menus), Apex Secure Vault exposes a highly optimized, static Engine API.

#### Step 6.1: Standard Manual Trigger

You can call the save or load functions from anywhere in your project using SaveStateEngine:

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

public class CheckpointTrigger : MonoBehaviour
{
    private void OnTriggerEnter(Collider other)
    {
        if (other.CompareTag("Player"))
        {
            // Triggers a complete encryption and save cycle manually
            SaveStateEngine.SaveAll();
            Debug.Log("Checkpoint Reached! Game Saved.");
        }
    }

    public void RestartFromLastSave()
    {
        // Manually reloads data from the vault
        SaveStateEngine.LoadAll();
    }
}

```

#### Step 6.2: Asynchronous Saving (Performance Friendly)

If your game has massive amounts of data and you want to prevent any potential frame drops (stutters) during saving, you can use our built-in Async variants. These execute the encryption and file-writing processes on a separate background thread!

```csharp
using UnityEngine;
using System.Threading.Tasks;
using ApexStudio.ApexSecureVault;

public class AsyncSaveTrigger : MonoBehaviour
{
    public async void PerformBackgroundSave()
    {
        Debug.Log("Starting background save...");
        
        // This runs without blocking the Unity main thread
        await SaveStateEngine.SaveAllAsync(); 
        
        Debug.Log("Background save completed securely!");
    }
}

```


---

# 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./manual-save-and-load-api-reference.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.
