> For the complete documentation index, see [llms.txt](https://mandor-labs.gitbook.io/mandor-labs-docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://mandor-labs.gitbook.io/mandor-labs-docs/save-load/getting-started/quickstart.md).

# Quickstart

Get up and running with the  Save Load  by following these simple steps.

## Steps

{% stepper %}
{% step %}

#### Create Save Data

This example show you how to create simple `CustomPlayerData`

```csharp
[Serializable]
public class CustomPlayerData
{
    public string id;
    public int score;
    public Dictionary<string,object> attributes;
}
```

{% endstep %}

{% step %}

#### Create Save Load Handler

In this step you will create `CustomSaveLoadHandler` that inherit from `SaveLoadFileHandler<T>`&#x20;

```csharp
[Serializable]
public class CustomSaveLoadHandler : SaveLoadFileHandler<CustomPlayerData>
{
    public override float order => 0;
    public override string description => "This is sample for custom save load handler";

    protected override CustomPlayerData SaveData()
    {
        //return your custom data here
    }

    protected override void LoadData(CustomPlayerData data)
    {
        //handle load data here
    }
}
```

{% endstep %}

{% step %}

### Create Save Load Handler Asset

In this step you will create asset to store your handler.

1. Right click on project and choose `Create` :arrow\_right: `Modular Labs` :arrow\_right: `Save Load` :arrow\_right: `Handler` .
2. Select `SaveLoadHandler` class that you create previous.
3. Make sure no validation message error appear.

<div data-with-frame="true"><figure><img src="https://3264224970-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F7DoTKI51WNZduP7daDNt%2Fuploads%2FqXY5R88w0rXZKYkLPSb5%2Fimage.png?alt=media&amp;token=bf936fdd-5f67-4991-b073-2be1e58498fe" alt=""><figcaption></figcaption></figure></div>
{% endstep %}

{% step %}

### Create Save Load Config

in this step you will create save load configuration to register your previous handler asset. If you want to enable Slot feature you can enable in this config asset.

To create save load config you can right click on project window and choose `Create` :arrow\_right: `Modular Labs` :arrow\_right: `Save Load` :arrow\_right: `Config` .

<div data-with-frame="true"><figure><img src="https://3264224970-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F7DoTKI51WNZduP7daDNt%2Fuploads%2F4BICcKyu9BNvN1deWKKd%2Fimage.png?alt=media&amp;token=bb23d12a-2eea-478d-a685-e78e0892c675" alt=""><figcaption></figcaption></figure></div>

{% hint style="danger" %}
I recommend having a different file extension for every SaveLoadHandler, so the data does not blend with other save data. For example, you have a save load handler for the player and the inventory. You can make two different file extensions. For player, you can use ‘.player’ and for inventory, you can use ‘.inv’.
{% endhint %}
{% endstep %}

{% step %}

### Register Into Database

Before you can use this system you need to setup register your `Save Load Config` into Save `Load Database Component` .

1. Create empty game object and add component `Save Load Database`&#x20;
2. Assign previous `Save Load Config Asset` into this component.

<div data-with-frame="true"><figure><img src="https://3264224970-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F7DoTKI51WNZduP7daDNt%2Fuploads%2Fh4Y2dW0l8iGWNMh0dx5s%2Fimage.png?alt=media&amp;token=8c232be2-0671-4f2f-915e-525d6ebb1b81" alt=""><figcaption></figcaption></figure></div>
{% endstep %}

{% step %}

### Press Play

Now you can press play on unity editor and check to `Save Load Handler Explorer` to makesure your `CustomSaveLoadhandler` is registered.

You can access this explorer from `Tools` :arrow\_right: `Modular Labs` :arrow\_right: `Save Load` :arrow\_right: `Handlers`

<div data-with-frame="true"><figure><img src="https://3264224970-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F7DoTKI51WNZduP7daDNt%2Fuploads%2FwkcZmYikmJWC2lxxH48h%2Fimage.png?alt=media&amp;token=9b7eb508-b4dd-470b-9d20-708d8881120c" alt=""><figcaption></figcaption></figure></div>
{% endstep %}

{% step %}

### Save & Load

This is example for save and load using API

```csharp

var fileName = "mysave";
var saveLoadHandler = SaveLoadHandler.GetSaveLoadHandler<CustomSaveLoadHandler>();
    
//save 
saveLoadHandler.Save(fileName);

//load
saveLoadHandler.Load(fileName);

//you need turn on Slot feature in SaveLoadConfigAsset to use slot feature and API
var slot = SaveLoadFileSlot.GetSlot(slotIndex);
            
//save slot
slot.Save();

//load slot
slot.Load();
```

{% endstep %}
{% endstepper %}
