# Loading

## Single

The main method to load data is the generic `GetData` method. Replace `T` with the type of the data you're trying to retrieve.

```csharp
// Where T is the data type
saveState.GetData<T>("DataID").OnComplete(result =>
{
    Debug.Log(result);
});
```

This method returns a [Save Operation](/esave/esave-pro/scripting/save-operation.md) (result type: `T`).

## Multiple (Single Type)

You can also retrieve a list of data of the same type:

```csharp
// Where T is the data type
saveState.GetData<T>("DataID1", "DataID2", "DataID3").OnComplete(result =>
{
    Debug.Log(result["DataID1"]);
    Debug.Log(result["DataID2"]);
    Debug.Log(result["DataID3"]);
});
```

This method returns a [Save Operation](/esave/esave-pro/scripting/save-operation.md) (result type: `Dictionary<string, T>`).

## Multiple (Multi-Type)

It's also possible to retrieve a list of data of unique types. This can be done by providing a value tuple where the first item is the data ID and the second is the data type.

```csharp
saveState.GetData(("DataID1", typeof(float)), ("DataID2", typeof(int)), ("DataID3", typeof(string))).OnComplete(result =>
{
    Debug.Log(result["DataID1"]);
    Debug.Log(result["DataID2"]);
    Debug.Log(result["DataID3"]);
});
```

This method returns a [Save Operation](/esave/esave-pro/scripting/save-operation.md) (result type: `Dictionary<string, dynamic>`).

## Special Methods

ESave features special methods to retrieve data for some otherwise unsavable Unity types.

#### Vector2

```csharp
saveState.GetVector2("DataID").OnComplete(v2 => Debug.Log(v2));
```

#### Vector3

```csharp
saveState.GetVector3("DataID").OnComplete(v3 => Debug.Log(v3));
```

#### Vector4

```csharp
saveState.GetVector4("DataID").OnComplete(v4 => Debug.Log(v4));
```

#### Vector2Int

```csharp
saveState.GetVector2Int("DataID").OnComplete(v2 => Debug.Log(v2));
```

#### Vector3Int

```csharp
saveState.GetVector3Int("DataID").OnComplete(v3 => Debug.Log(v3));
```

#### Quaternion

```csharp
saveState.GetQuaternion("DataID").OnComplete(q => Debug.Log(q));
```

#### Color

```csharp
saveState.GetColor("DataID").OnComplete(c => Debug.Log(c));
```

#### Transform

```csharp
// Returns a SavableTransform
saveState.GetTransform("DataID").OnComplete(st =>
{
    // Set position and rotation
    transform.SetPositionAndRotation(st.Position, st.Rotation);
});
```

#### RectTransform

```csharp
saveState.GetRectTransform("DataID").OnComplete(srt =>
{
    // Set anchored position, size, and rotation
    var rectTransform = transform as RectTransform;
    rectTransform.anchoredPosition = srt.AnchoredPosition;
    rectTransform.sizeDelta = srt.SizeDelta;
    rectTransform.rotation = srt.Rotation;
});
```


---

# 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/loading.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.
