# Saving

## Single

Each piece of data in a save state has an ID (`string`). This makes it possible to retrieve specific data by ID.

Saving data can be done with a single line with  the `AddData` method.&#x20;

```csharp
saveState.AddData("MyDataID", data);
```

The first parameter is the ID of the data, and the second parameter is the data itself. Any serializable data type can be saved. However,  most Unity types are not savable. ESave can save common Unity data types, including (but not limited to) `Vector2`, `Vector3`, `Vector4`, `Quaternion`, `Color`, `Transform`, and `RectTransform`.

This method returns a [Save Operation](/esave/esave-pro/scripting/save-operation.md) (result type: `bool`).  The result is true if the data was successfully&#x20;added. Otherwise, false.

## Multiple

You can use the `AddData` method to save multiple data with one call. This can be done by providing the data as a value tuple with a string as the first item and the data as the second.

```csharp
saveState.AddData(("MyDataID1", myData1), ("MyDataID2", myData2));
```

This method returns a [Save Operation](/esave/esave-pro/scripting/save-operation.md) (result type: `bool`).  The result is true if all provided data was&#x20;added successfully. If even one fails to be added, the result is false.


---

# 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://espergames.gitbook.io/esave/esave-pro/scripting/saving-and-loading/managing-data/saving.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.
