Backbone - Persistence
 
Loading...
Searching...
No Matches
Backbone::HierarchyPersistence Class Reference

Saves and restores the hierarchy state of this GameObject and its children. You can selectively enable the saving of position, rotation, scale, and active state. Ideal for scenes where multiple items or entities need to remember their state after being modified or deactivated. More...

Inheritance diagram for Backbone::HierarchyPersistence:

Classes

struct  TransformData
 Struct to hold transform and active state data for a single object. More...
 

Public Member Functions

void OnSave ()
 Called automatically when saving the game. Captures the selected data (position, rotation, etc.) for each child in the hierarchy.
 
void OnLoad ()
 Called automatically when loading the game. Restores each child object's transform and active state based on the saved data.
 

Public Attributes

bool savePosition = false
 Whether to save and restore each object's world position.
 
bool saveRotation = false
 Whether to save and restore each object's world rotation.
 
bool saveScale = false
 Whether to save and restore each object's local scale.
 
bool saveActiveState = true
 Whether to save and restore each object's active state.
 

Static Private Member Functions

static string GetRelativePath (Transform root, Transform target)
 Builds the relative path of a child transform with respect to a parent.
 

Private Attributes

Dictionary< string, TransformDatasavedStates = new Dictionary<string, TransformData>()
 Stores the persistent state (position, rotation, scale, active) of each child by path.
 

Detailed Description

Saves and restores the hierarchy state of this GameObject and its children. You can selectively enable the saving of position, rotation, scale, and active state. Ideal for scenes where multiple items or entities need to remember their state after being modified or deactivated.

Member Function Documentation

◆ GetRelativePath()

static string Backbone::HierarchyPersistence::GetRelativePath ( Transform root,
Transform target )
staticprivate

Builds the relative path of a child transform with respect to a parent.

Parameters
rootThe root transform to start from.
targetThe child transform to generate the path for.
Returns
The relative hierarchy path.

◆ OnLoad()

void Backbone::HierarchyPersistence::OnLoad ( )

Called automatically when loading the game. Restores each child object's transform and active state based on the saved data.

◆ OnSave()

void Backbone::HierarchyPersistence::OnSave ( )

Called automatically when saving the game. Captures the selected data (position, rotation, etc.) for each child in the hierarchy.

Member Data Documentation

◆ saveActiveState

bool Backbone::HierarchyPersistence::saveActiveState = true

Whether to save and restore each object's active state.

◆ savedStates

Dictionary<string, TransformData> Backbone::HierarchyPersistence::savedStates = new Dictionary<string, TransformData>()
private

Stores the persistent state (position, rotation, scale, active) of each child by path.

◆ savePosition

bool Backbone::HierarchyPersistence::savePosition = false

Whether to save and restore each object's world position.

◆ saveRotation

bool Backbone::HierarchyPersistence::saveRotation = false

Whether to save and restore each object's world rotation.

◆ saveScale

bool Backbone::HierarchyPersistence::saveScale = false

Whether to save and restore each object's local scale.


The documentation for this class was generated from the following file: