> For the complete documentation index, see [llms.txt](https://docs.gercstudio.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.gercstudio.com/other-components/save-manager.md).

# Save Manager

{% hint style="info" %}
There are 2 demo scenes in the project *<mark style="color:green;">**(Universal Shooter Kit -> Demos -> Scenes -> SinglePlayer -> Save System -> Save System (Scene 1) / (Scene 2))**</mark>*&#x20;

Open and run one of them to test the Save System.
{% endhint %}

### Adding to the game

To create a save system in your game, add a <mark style="color:green;">**SaveManager**</mark> script to any object in your scene.

&#x20;In this script you can choose which parameters will be saved, as well as enable autosave mode.

<figure><img src="https://3854890582-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-Lf4aWZpqUiSipiEh-D6%2Fuploads%2FwUxb2hZL48dYHQKxFCIw%2FSave%20Manager.png?alt=media&amp;token=950d4cac-22d7-4b31-8cdf-a0aeec104c0a" alt=""><figcaption></figcaption></figure>

{% hint style="info" %}
If you're going to save your character's inventory, make sure all the weapons you use are in the special pool *<mark style="color:green;">**(Tools -> USK -> Project Settings -> Weapons Pool)**</mark>*.

If your game has weapons that can be picked up, they should be added to the pool as well. Or add weapon prefabs to your scene and **don't unpack them**.
{% endhint %}

<figure><img src="https://3854890582-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-Lf4aWZpqUiSipiEh-D6%2Fuploads%2FAfuzHbg1mBZLH0GKZpff%2FPrefab%20Example.png?alt=media&amp;token=99e24b7e-1951-4c8c-bd72-354d21cd71e3" alt=""><figcaption></figcaption></figure>

### How it works

* **(Load)** Every time you load a scene with the <mark style="color:green;">**SaveManager**</mark> component in it, all saved progress is loaded and applied (depending on which parameters you have activated).
* **(Save)** To save your progress, you need to call the save function (anywhere and at any time):

```
SaveManager.Instance.SaveData();
```

* **(Clear)** To clear all progress, call the following function:

```
SaveManager.Instance.DeleteAllSavedData();
```

{% hint style="info" %}
In the manager 2 classes are saved separately: the first class - **"Character Data"**, the second - **"Scene Data"**.

**Character Data** is saved in a single copy (contains character health and inventory values)

**Scene Data** is saved for each scene separately (contains the position of the character, dropped/picked up items, and AI parameters) and refers to scenes by their names **(please note: when you rename a scene, the linked save won't be loaded)**
{% endhint %}

### Custom Save Data

If you need to save some other parameters, use the prepared <mark style="color:purple;">**CustomData**</mark> class in the <mark style="color:green;">**SaveManager**</mark> script.

{% hint style="info" %}
You can only save serializable variables - [Unity Docs](https://docs.unity3d.com/Manual/script-Serialization.html#SerializationRules).
{% endhint %}

<figure><img src="https://3854890582-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-Lf4aWZpqUiSipiEh-D6%2Fuploads%2FRQPICPwLLYWIdwUlRN8a%2FCustom%20Data%201.png?alt=media&amp;token=7773beb5-8a53-4923-a5e6-d16abd9894be" alt=""><figcaption></figcaption></figure>

Also, you need to apply the loaded parameters after loading the save files.

<figure><img src="https://3854890582-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-Lf4aWZpqUiSipiEh-D6%2Fuploads%2Fra0FtcFEfnblHxtCP7W9%2FCustom%20Data%202.png?alt=media&amp;token=733d2118-cc7d-44a1-a0d4-0e07bf2e6a4a" alt=""><figcaption></figcaption></figure>

### Easy Save Integration

By default, all data is saved to JSON files without encryption. If you want to expand these features, then activate an integration with the Easy Save system.

{% content-ref url="/pages/yWyaUGhZ3sZWdpkVdCDG" %}
[Easy Save 3](/integrations-manager/easy-save-3.md)
{% endcontent-ref %}
