docs.unity3d.com
Search Results for

    Show / Hide Table of Contents

    Class MyCustomNetworkVariable

    Bare minimum example of NetworkVariableBase derived class

    Inheritance
    object
    NetworkVariableBase
    MyCustomNetworkVariable
    Implements
    IDisposable
    Inherited Members
    NetworkVariableBase.GetBehaviour()
    NetworkVariableBase.Initialize(NetworkBehaviour)
    NetworkVariableBase.OnInitialize()
    NetworkVariableBase.SetUpdateTraits(NetworkVariableUpdateTraits)
    NetworkVariableBase.ExceedsDirtinessThreshold()
    NetworkVariableBase.DefaultReadPerm
    NetworkVariableBase.DefaultWritePerm
    NetworkVariableBase.Name
    NetworkVariableBase.ReadPerm
    NetworkVariableBase.WritePerm
    NetworkVariableBase.SetDirty(bool)
    NetworkVariableBase.MarkNetworkBehaviourDirty()
    NetworkVariableBase.ResetDirty()
    NetworkVariableBase.IsDirty()
    NetworkVariableBase.CanClientRead(ulong)
    NetworkVariableBase.CanClientWrite(ulong)
    NetworkVariableBase.Dispose()
    object.Equals(object)
    object.Equals(object, object)
    object.GetHashCode()
    object.GetType()
    object.MemberwiseClone()
    object.ReferenceEquals(object, object)
    object.ToString()
    Namespace: DocumentationCodeSamples
    Assembly: Unity.Netcode.Runtime.Tests.dll
    Syntax
    [Serializable]
    public class MyCustomNetworkVariable : NetworkVariableBase, IDisposable

    Methods

    ReadDelta(FastBufferReader, bool)

    Used to read partial updates rather than synchronizing the full state on every change.

    Declaration
    public override void ReadDelta(FastBufferReader reader, bool keepDirtyDelta)
    Parameters
    Type Name Description
    FastBufferReader reader

    The stream to read the delta from

    bool keepDirtyDelta

    Whether or not the delta should be kept as dirty or consumed

    Overrides
    NetworkVariableBase.ReadDelta(FastBufferReader, bool)

    ReadField(FastBufferReader)

    Reads the complete state from the reader and applies it

    Declaration
    public override void ReadField(FastBufferReader reader)
    Parameters
    Type Name Description
    FastBufferReader reader

    The stream to read the state from

    Overrides
    NetworkVariableBase.ReadField(FastBufferReader)

    WriteDelta(FastBufferWriter)

    Used to write partial updates rather than synchronizing the full state on every change.

    Declaration
    public override void WriteDelta(FastBufferWriter writer)
    Parameters
    Type Name Description
    FastBufferWriter writer

    The stream to write the state to

    Overrides
    NetworkVariableBase.WriteDelta(FastBufferWriter)

    WriteField(FastBufferWriter)

    Writes the complete state of the variable to the writer

    Declaration
    public override void WriteField(FastBufferWriter writer)
    Parameters
    Type Name Description
    FastBufferWriter writer

    The stream to write the state to

    Overrides
    NetworkVariableBase.WriteField(FastBufferWriter)

    Implements

    IDisposable
    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)