# Inventory Serialization

For serializing an inventory component (assuming you are using the included serialization method) you simply need to call the SaveInventory function in your inventory.

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

This function will output a serializable structure that includes the contents and the ID to distinguish this inventory from the rest. You simply save the output of this function to a variable in your SaveGame object and then when loading it, you can call LoadFromSave which will receive the structure you saved in the previous step and recreate the inventory from it.

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


---

# Agent Instructions: 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:

```
GET https://friendlysadist.gitbook.io/vaultlogic/code-and-design/persistence/inventory-serialization.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
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.
