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

# Save/Load System

## Overview

The Save/Load system of the Inventory System is based off of JSON.Net.

{% embed url="<https://www.newtonsoft.com/json>" %}

Unity officially supports it, but does not support native Unity types like Gameobject or Vector3 etc, by default. You can use converters to get around it, but for now, that's not necessary.

## Setting up the System

To set up the Save/Load system is super easy.

You can either make your own buttons/conditions for it, but in the InventoryCanvas, under the InventoryTabsArea, I've added a Save/Load button there for you.

To Save/Load, you simply either need to set the buttons up like this:

<figure><img src="/files/KKboneHVhpB8nLiTXKq4" alt=""><figcaption><p>Saving</p></figcaption></figure>

<figure><img src="/files/XiNT0hE1AkA5ouGt00rT" alt=""><figcaption><p>Loading</p></figcaption></figure>

OR if you want to have another method to call Saving/Loading, just simply find a reference to InventoryMaster, and call:

* To Save -> SerializeJSON()
* To Load -> DeserializeJSON()

And that's it.\
\
It will then save at: Application.persistentDataPath under the file name of: playerInventories.json

## Encryption

If you wish to enable AES256 encryption on your save data, you can simply do so by turning on **Using Save System Encryption?** on the Inventory Master component.

<figure><img src="/files/4VkO5VNX98W32OQtj1QQ" alt=""><figcaption></figcaption></figure>

This will then encrypt your data to AES256 standard. You can find the Key and IV it uses to encrypt inside the JSONDataService.cs script:\ <br>

<figure><img src="/files/kSq5lP28osWkNhBL01Er" alt=""><figcaption></figcaption></figure>

If you want to generate a new KEY and IV, the easiest way I've found is to just use ChatGPT.

Simply ask it as I have below:<br>

<figure><img src="/files/HK6TwPQC2wEdcu9Gp3QP" alt=""><figcaption></figcaption></figure>


---

# 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://malbersanimations.gitbook.io/animal-controller/save-load-system.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.
