docs.unity.cn
    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 Unity.NetCode.Generators.UserDefinedTemplates.RegisterTemplates(System.Collections.Generic.List{Unity.NetCode.Generators.TypeRegistryEntry},System.String) method by adding your new typesto the templates list.

    Back to top Copyright © 2023 Unity Technologies — Terms of use
    Generated by DocFX
    on Thursday, August 10, 2023