> For the complete documentation index, see [llms.txt](https://tariksavas.gitbook.io/tarsave/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://tariksavas.gitbook.io/tarsave/docs/how-to-use/transform-data.md).

# Transform Data

Unity's `Transform` objects are not serializable by default, meaning they cannot be directly saved and loaded. However, Tarsave provides a solution for saving and loading `Transform` data through a custom `TransformData` class. This class stores the position, rotation, and scale of a `Transform`, making it compatible with Tarsave's save and load operations.

**Saving Transform Data:** When saving `Transform` data, a `TransformData` instance is created for each `Transform`. This instance is then saved using Tarsave's `Save` method.

```csharp
public void Save()
{
    TransformData transformData = new TransformData(_transform);
    bool result = _dataPersistenceService.Save("Key", transformData);
}
```

**Loading Transform Data:** When loading, the previously saved `TransformData` instance is retrieved and applied to the relevant `Transform` object using the `ApplyTransform` method.

```csharp
public void Load()
{
    TransformData transformData = _dataPersistenceService.Load<TransformData>("Key");
    transformData.ApplyTransform(_transform);
}
```

The `TransformData` class is specifically designed to store the position, rotation, and scale of a `Transform`. It also provides the `ApplyTransform` method to apply the stored data back to a `Transform` when loading.

This approach allows you to easily manage and persist `Transform` data in Unity, overcoming the limitations of Unity's default serialization system.
