> 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="/files/QGK38vmAOb8Pz2yOikoo" 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="/files/IGTFchVdyGjFOlcaK2Nb" 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="/files/sd2zQaZh7JOM4BFoV3IL" alt=""><figcaption></figcaption></figure>

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

<figure><img src="/files/eojHe3h2FhgAUdyhv0lx" 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 %}
