docs.unity3d.com
Search Results for

    Show / Hide Table of Contents

    Struct PostTransformMatrix3DScaleVariant

    A serialization strategy for Unity.Transforms.PostTransformMatrix that replicates only the non-uniform (3D) scale stored in the matrix, as 3 quantized floats instead of the full 16.

    Inherited Members
    ValueType.Equals(object)
    ValueType.GetHashCode()
    object.Equals(object, object)
    object.GetType()
    object.ReferenceEquals(object, object)
    Namespace: Unity.Netcode
    Assembly: Unity.NetCode.dll
    Syntax
    [Preserve]
    [GhostComponentVariation(typeof(PostTransformMatrix), "PostTransformMatrix - 3D Scale", false)]
    public struct PostTransformMatrix3DScaleVariant
    Remarks

    Unity.Transforms.LocalTransform.Scale is uniform only, so per-axis scale lives engine-side in the optional Unity.Transforms.PostTransformMatrix. This variant extracts that scale and re-applies it on the receiving side (see SetScale(in float4x4, float3)), preserving local translation and rotation - the latter up to diagonal signs, which the replicated scale owns (see MatrixScaleHelper).

    Rotation, translation and shear are never sent. Negative (mirrored) scale is replicated; see MatrixScaleHelper for the sign convention and its limits.

    Defaults: Unity.Transforms.PostTransformMatrix uses DontSerializeVariant so existing projects pay no extra bandwidth. Opt in per-prefab, or globally via DefaultVariantSystemBase.

    To write your own variant, follow the usual variant flow but set SubType=PostTransformMatrixScale to reuse this custom serialization. Replicating a subset of axes requires a custom template - see our docs. If you need more than scale replicated, reach out so we can prioritise it.

    Fields

    Value

    The non-uniform scale encoded in the matrix is replicated with a default quantization unit of 1000 (so roughly 1mm precision per axis).

    Declaration
    public float4x4 Value
    Field Value
    Type Description
    float4x4
    In This Article
    Back to top
    Copyright © 2026 Unity Technologies — Trademarks and terms of use
    • Legal
    • Privacy Policy
    • Cookie Policy
    • Do Not Sell or Share My Personal Information
    • Your Privacy Choices (Cookie Settings)