docs.unity3d.com
Search Results for

    Show / Hide Table of Contents

    Method Write

    Write(FastBufferWriter, ref T)

    Serialize a value using the best-known serialization method for a generic value. Will reliably serialize any value that is passed to it correctly with no boxing.

    Note: If you are using this in a custom generic class, please make sure your class is decorated with GenerateSerializationForGenericParameterAttribute so that codegen can initialize the serialization mechanisms correctly. If your class is NOT generic, it is better to use FastBufferWriter directly.

    If the codegen is unable to determine a serializer for a type, UserNetworkVariableSerialization<T>.WriteValue is called, which, by default, will throw an exception, unless you have assigned a user serialization callback to it at runtime.

    Declaration
    public static void Write(FastBufferWriter writer, ref T value)
    Parameters
    Type Name Description
    FastBufferWriter writer
    T value
    In This Article
    Back to top
    Copyright © 2024 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)