Skip to main content

TransformSaveCollection

A class in Root.Township, the global namespace.

Asset that stores saved transforms for a hierarchy by object name and can load them back. Saving is stubbed out in this build: Save only empties the list.

Constructors​

MemberWhat it is
TransformSaveCollection()Use ScriptableObject.CreateInstance instead of new; Unity loads the saved ones from assets.

Fields​

3 private and internal fields
MemberWhat it is
private string displayNameName for this save in the editor. Default "Test".
private Dictionary<string, TransformSaveObject> savedTransformsBacking dictionary for SavedTransforms, saves by transform name. Built from the list on first read.
private List<TransformSaveObject> savedTransformsListThe saved transforms as a serialized list.

Properties​

MemberWhat it is
Dictionary<string, TransformSaveObject> SavedTransforms { get; }Saved transforms by object name, built from the list on first use.

Methods​

MemberWhat it is
void DeleteIndividualSave(string name)Does nothing in this build.
TransformSave GetSaveForTransform(Transform transform)The saved transform for an object with this transform's name, or null.
override bool LoadInto(Transform transform)Applies the saved transforms to the hierarchy by name. False if the root isn't in the save.
override void Save(Transform transform, bool isLocalSave)Clears the saved list and walks the hierarchy, but the per-transform save is empty, so nothing is stored.
void SetupDictionary()Rebuilds the name lookup from the saved list.
3 private and internal methods
MemberWhat it is
private void RecursiveLoad(Transform transform)Applies saved values to a transform and all its children, matched by name.
private void RecursiveSave(Transform transform, bool isLocalSave)Calls SaveTransform on a transform and all its children.
private void SaveTransform(Transform transform, bool isLocalSave)Empty in this build, so Save only clears the list.

Used in​

Members of other types that take, return or hold a TransformSaveCollection: