# Save Scene Objects

### Example Code

```csharp
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using VoxelBusters.Serialization; 
using System.IO;


public class Example : MonoBehaviour 
{
    private List<GameObject> m_spawnedList = new List<GameObject>();
    public GameObject prefab;
    
    // define action methods
    public void Spawn()
    {
        GameObject clone = SerializationUtility.Instantiate(prefab);
        
        // add randomness
        Vector3 randPos = Random.insideUnitCircle * 3f;
        randPos.y += 1f;
        
        // set random position
        clone.transform.position = randPos;
        
        // add object to list
        m_spawnedList.Add(clone);
    }
    
    public void Save()
    {
        SerializationManager.Serialize("spawnedList", m_spawnedList);
    }
    
    public void Load()
    {
        // clear existing entries
        for (int iter = 0; iter > m_spawnedList.Count; iter++)
        {
            SerializationUtility.Destroy((m_spawnedList[iter]));
        }
        m_spawnedList.Clear();
        
        // load saved data
        m_spawnedList = SerializationManager.Deserialize<List<GameObject>>("spawnedList");
    }
}
```

{% embed url="<https://youtu.be/OgotaZc2Q_k>" %}


---

# 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/video-tutorials/save-scene-objects.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.
