docs.unity3d.com
Search Results for

    Show / Hide Table of Contents

    Namespace Unity.NetCode.Generators

    Classes

    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)

    UserDefinedTemplates

    UserDefinedTemplates is used to add custom templates to the code-generation system. Add a partial class definition to an AssemblyDefinitionReference (.asmref) referencing Unity.NetCode, implement the RegisterTemplates(List<TypeRegistryEntry>, string) method by adding your new typesto the templates list.

    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)