docs.unity3d.com
Search Results for

    Show / Hide Table of Contents

    Class TypeRegistryEntry

    Used to configure the serialization/deserialization code-generation for a specific type (primitive or struct) and combination of GhostFieldAttribute quantized, smooting and sub-type flags. The tuple [Type, Quantized, Smoothing, SubType] is mapped to a template file that contains the code to use to serialize/deserialize this specific type. It is possible so to register for each individual type multiple serialization rules, that can be selected using the GhostFieldAttribute. For example, the default float type (subtype 0) has 4 different serialization rules:

    (float, unquantized, Clamp, 0)

    (float, unquantized, InterpolateAndExtrapolate, 0)

    (float, quantized, Clamp, 0)

    (float, quantized, InterpolateAndExtrapolate)

    Inheritance
    object
    TypeRegistryEntry
    Inherited Members
    object.Equals(object)
    object.Equals(object, object)
    object.GetHashCode()
    object.GetType()
    object.MemberwiseClone()
    object.ReferenceEquals(object, object)
    Namespace: Unity.NetCode.Generators
    Assembly: Unity.NetCode.dll
    Syntax
    public class TypeRegistryEntry

    Fields

    Composite

    State if the type, template pair is a composite type. Must be used only for structs that contains multiple fields of the same type (ex: float3). Whan a type is configured as composite, the Template model is used recursively on all the fields to generate the serialization code, without the need to crate a specific template for the struct itself.

    Declaration
    public bool Composite
    Field Value
    Type Description
    bool

    Quantized

    floating point number can be serialized in two ways:

    - as a full 32bit raw value

    - as a fixed-point number, with a given precision (see Quantization)

    The use of quantization requires special handling by the code-generation and in particular the code in the template file must uses certain rules. You should set this flag to true if the type-template combination should be used for quantized types.

    Declaration
    public bool Quantized
    Field Value
    Type Description
    bool

    Smoothing

    The smoothing supported by this template and type combination.

    Declaration
    public SmoothingAction Smoothing
    Field Value
    Type Description
    SmoothingAction

    SubType

    The sub-type value for this specific type=template combination. This is used to map the [type, Quantized, Smooting, Suptype] tuple specified by the GhostFieldAttribute properties to the correct serializer type.

    Declaration
    public int SubType
    Field Value
    Type Description
    int

    SupportCommand

    State if the type, template pairs can be used when serializing commands.

    Declaration
    public bool SupportCommand
    Field Value
    Type Description
    bool

    Template

    Mandatory, the template file to use. Must be relative path to the Asset or Package folder.

    Declaration
    public string Template
    Field Value
    Type Description
    string

    TemplateOverride

    Optional, the template file to use to overrides/change the serializaton code present in the base Template file. Must be relative path to the Asset or Package folder.

    Declaration
    public string TemplateOverride
    Field Value
    Type Description
    string

    Type

    Mandatory, the qualified typename of the type (namespace + type name).

    Declaration
    public string Type
    Field Value
    Type Description
    string
    In This Article
    Back to top
    Copyright © 2025 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)