logo SERENITY
Game Systems Foundation
Search Results for

    Show / Hide Table of Contents

    Class TransformTargetInfo

    Represents a registered transform target with cached original scale and rotation.

    Inheritance
    object
    TransformTargetInfo
    Inherited Members
    object.ToString()
    object.Equals(object)
    object.Equals(object, object)
    object.ReferenceEquals(object, object)
    object.GetHashCode()
    object.GetType()
    Namespace: Serenity.ProceduralAnimator.Infrastructure.Services
    Assembly: Serenity.UnityProceduralAnimator.Infrastructure.dll
    Syntax
    public sealed class TransformTargetInfo
    Remarks

    A class, not a struct, deliberately: Apply(TransformDelta) mutates LastAppliedZDegrees while enumerating the target dictionary, and mutating a reference type in place needs no dictionary re-assignment — Unity's Mono BCL bumps the dictionary's enumeration version on ANY indexer write, including overwriting an existing key, which would throw "Collection was modified" mid-foreach.

    Constructors

    TransformTargetInfo(Transform, Vector3, Quaternion, Vector3, bool)

    Creates a new TransformTargetInfo. LastAppliedZDegrees starts at null (at original) since a freshly registered target has not had a rotation delta applied yet, and PositionDriven starts false for the same reason. LastAppliedPositionOffset starts null alongside it — no offset has been applied yet either.

    Declaration
    public TransformTargetInfo(Transform transform, Vector3 originalScale, Quaternion originalRotation, Vector3 originalPosition, bool allowPosition)
    Parameters
    Type Name Description
    Transform transform
    Vector3 originalScale
    Quaternion originalRotation
    Vector3 originalPosition
    bool allowPosition

    Fields

    AllowPosition

    Whether this target accepts position-channel animation, set once at registration (RegisterTarget(TransformId, Transform, bool)'s allowPositionOverride parameter). Position is layout-hostile for a FLEXBOX-parented HUD element (see TransformDelta's own remarks), so most targets register with this false, and Apply(TransformDelta) never even reads or writes OriginalPosition/PositionDriven for them.

    Declaration
    public bool AllowPosition
    Field Value
    Type Description
    bool

    LastAppliedPositionOffset

    The position OFFSET last written to Transform's local position by Apply(TransformDelta)'s position-entry branch, or null when no offset is currently applied (undriven, or just restored). Unlike LastAppliedZDegrees this is NOT a change-detection gate — Apply(TransformDelta)'s position gate still compares against the live UnityEngine.Transform.localPosition, same as scale (position's epsilon is negligible at pixel magnitudes, unlike rotation's). This field exists purely for baseline RECOVERY: RecachePositionBaselines() uses it to undo only the offset this applier itself last wrote when re-deriving OriginalPosition from the live transform, so an external mover's contribution (e.g. a parent rect/anchor change) is recovered cleanly instead of being folded into the new baseline.

    Declaration
    public Vector3? LastAppliedPositionOffset
    Field Value
    Type Description
    Vector3?

    LastAppliedZDegrees

    The Z-degrees offset last written to Transform's local rotation by Apply(TransformDelta), or null when the transform currently sits at OriginalRotation (no rotation entry applied). This is the change-detection cache the rotation gate compares against instead of the live transform — see Apply(TransformDelta)'s remarks for why.

    Declaration
    public float? LastAppliedZDegrees
    Field Value
    Type Description
    float?

    OriginalPosition

    The original local position, cached for reset. Only meaningful when AllowPosition is true. Only READS of this field are gated on that flag — see Apply(TransformDelta)'s remarks; writes are unconditional and harmless: RegisterTarget(TransformId, Transform, bool) and CacheOriginalScales() always cache it regardless of AllowPosition, since nothing ever reads it back for a target that does not allow position. RecachePositionBaselines() is the one writer that IS gated on AllowPosition, simply because re-deriving a baseline nothing reads would be pointless work.

    Declaration
    public Vector3 OriginalPosition
    Field Value
    Type Description
    Vector3

    OriginalRotation

    The original local rotation, cached for reset.

    Declaration
    public Quaternion OriginalRotation
    Field Value
    Type Description
    Quaternion

    OriginalScale

    The original local scale, cached for reset.

    Declaration
    public Vector3 OriginalScale
    Field Value
    Type Description
    Vector3

    PositionDriven

    Latch: true once Apply(TransformDelta) has actually written Transform's local position from a position entry, false once it has been restored (or was never driven). THE load-bearing piece of the position facet's safety story: an UNDRIVEN target's position must never be written at all — not even to its own original value — so this applier never becomes a standing position authority over a target nothing is currently animating. See Apply(TransformDelta)'s remarks for the full three-way branch this latch drives.

    Declaration
    public bool PositionDriven
    Field Value
    Type Description
    bool

    Transform

    The Unity transform reference.

    Declaration
    public Transform Transform
    Field Value
    Type Description
    Transform
    In this article
    © 2026 Serenity. All Rights Reserved