Transform Auto-Save
Tracking position, rotation, and scale variables manually for numerous active objects (e.g., platforms, collectibles, traps) can clog up your gameplay scripts. Save System Pro resolves this with AutoSaveTransform — an automated, drag-and-drop runtime script.
🤖 What does it track?
When attached to a GameObject, AutoSaveTransform hooks into the active save state. It automatically tracks:
- GameObject Position (
Vector3) - GameObject Rotation (
Quaternion) - GameObject Scale (
Vector3)
⚙️ Drag-and-Drop Setup
To automate any object’s transform state:
- Select the target GameObject in your Unity hierarchy.
- Ensure it has an
AutoSaveIdentifiercomponent attached (refer to the Auto-Save Manager page for details on GUID generation). - Click Add Component in the Inspector.
- Search for and select
AutoSaveTransform. - Customize tracking choices using the toggles in the Inspector.
🛠️ Custom Inspector Parameters
In the Unity Inspector panel for AutoSaveTransform, you can configure specific settings to match your gameplay physics:
| Setting | Type | Description |
|---|---|---|
Save Position | bool | Toggles tracking of the object’s spatial coordinates. |
Save Rotation | bool | Toggles tracking of the object’s angular rotation. |
Save Scale | bool | Toggles tracking of the object’s absolute scale dimensions. |
Use Local Space | bool | If toggled On, saves values relative to the object’s parent in the hierarchy (transform.localPosition). If toggled Off, saves absolute world coordinates (transform.position). Very useful for nested items on moving trains or moving platforms! |
🚀 Deep Technical Details
The AutoSaveTransform script is highly optimized to prevent garbage allocation (GC) and frame spikes during runtime transitions:
- Identifier Binding: On scene load, it maps its serializable coordinates under a unique key calculated as
[GUID]_transform(where GUID is the unique key generated by the object’sAutoSaveIdentifierscript). - Zero-Stutter Snapshotting: Instead of constantly query-caching values every frame, it reads coordinates and writes updates directly during central save-triggers managed by the global
AutoSaveManager, keeping your frame times clean and uncompromised.