# Save Data (Serialize)

For using this plugin methods you need to import the required namespace. Please include the below statement at namespace include list

```
using VoxelBusters.Serialization;
```

We provide a generic method to save(Serialize) any kind of data. For serializing data you need to specify a key. This key is used to retrieve the data back again during deserialization.

{% hint style="info" %}
**Performance Tip** : For Int, Float and String we provide direct methods to serialize and deserialize to get best performance when compared to generic method call. So, if possible try to use direct call if applicable.
{% endhint %}

### Examples

#### Save Int

{% tabs %}
{% tab title="Generic Usage" %}

```csharp
SerializationManager.Serialize<int>("myInt",123);
```

{% endtab %}

{% tab title="Direct Usage" %}

```csharp
SerializationManager.SerializeInt32("myInt",123);
```

{% endtab %}
{% endtabs %}

#### Save Float

{% tabs %}
{% tab title="Generic Usage" %}

```csharp
SerializationManager.Serialize<float>("myFloat",111.11f);
```

{% endtab %}

{% tab title="Direct Usage" %}

```
SerializationManager.SerializeSingle("myFloat",111.11f);
```

{% endtab %}
{% endtabs %}

#### Save Double

```csharp
SerializationManager.Serialize<double>("myDouble",129.0);
```

#### Save String

{% tabs %}
{% tab title="Generic Usage" %}

```csharp
SerializationManager.Serialize<string>("myString","string value");
```

{% endtab %}

{% tab title="Direct Usage" %}

```csharp
SerializationManager.SerializeString("myString","string value");
```

{% endtab %}
{% endtabs %}

#### Save GameObject

```
SerializationManager.Serialize<GameObject>("gameObject",gameObjectInstance);
```

#### Save List

```
List<GameObject> gameObjectsList = new List<GameObject>();
....
....
....
SerializationManager.Serialize<List<GameObject>>("gameObjects", gameObjectList);
```

## Video Tutorials

{% content-ref url="/pages/-LNzVxmTkn46VuKUgpZi" %}
[Basic Save](/tutorials/video-tutorials/basic-save.md)
{% endcontent-ref %}

{% content-ref url="/pages/-LNzWAcWTuR\_CEev9\_yj" %}
[Save Scene Objects](/tutorials/video-tutorials/save-scene-objects.md)
{% endcontent-ref %}

{% content-ref url="/pages/-LNzWRi-AA89Cb4bcrTC" %}
[Save Custom Objects](/tutorials/video-tutorials/save-custom-objects.md)
{% endcontent-ref %}

{% content-ref url="/pages/-LNzWYJRUvPJtX33CIMy" %}
[Batch Save Calls](/tutorials/video-tutorials/batch-save-calls.md)
{% endcontent-ref %}


---

# 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://assetstore.easysave.voxelbusters.com/tutorials/save-data-serialize.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.
