docs.unity3d.com
Search Results for

    Show / Hide Table of Contents

    Interface INetworkVariable

    Interface for network value containers

    Namespace: MLAPI.NetworkVariable
    Assembly: Unity.Multiplayer.MLAPI.Runtime.dll
    Syntax
    public interface INetworkVariable

    Methods

    CanClientRead(ulong)

    Gets Whether or not a specific client can read to the varaible

    Declaration
    bool CanClientRead(ulong clientId)
    Parameters
    Type Name Description
    ulong clientId

    The clientId of the remote client

    Returns
    Type Description
    bool

    Whether or not the client can read to the variable

    CanClientWrite(ulong)

    Gets Whether or not a specific client can write to the varaible

    Declaration
    bool CanClientWrite(ulong clientId)
    Parameters
    Type Name Description
    ulong clientId

    The clientId of the remote client

    Returns
    Type Description
    bool

    Whether or not the client can write to the variable

    GetChannel()

    Returns the name of the channel to be used for syncing

    Declaration
    NetworkChannel GetChannel()
    Returns
    Type Description
    NetworkChannel

    The name of the channel to be used for syncing

    IsDirty()

    Gets Whether or not the container is dirty

    Declaration
    bool IsDirty()
    Returns
    Type Description
    bool

    Whether or not the container is dirty

    ReadDelta(Stream, bool, ushort, ushort)

    Reads delta from the reader and applies them to the internal value

    Declaration
    void ReadDelta(Stream stream, bool keepDirtyDelta, ushort localTick, ushort remoteTick)
    Parameters
    Type Name Description
    Stream stream

    The stream to read the delta from

    bool keepDirtyDelta

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

    ushort localTick

    The local network tick at which this var was written, on the machine it was written

    ushort remoteTick

    The remote network tick at which this var was sent by the host

    ReadField(Stream, ushort, ushort)

    Reads the complete state from the reader and applies it

    Declaration
    void ReadField(Stream stream, ushort localTick, ushort remoteTick)
    Parameters
    Type Name Description
    Stream stream

    The stream to read the state from

    ushort localTick

    The local network tick at which this var was written, on the machine it was written

    ushort remoteTick

    The remote network tick at which this var was sent by the host

    ResetDirty()

    Resets the dirty state and marks the variable as synced / clean

    Declaration
    void ResetDirty()

    SetNetworkBehaviour(NetworkBehaviour)

    Sets NetworkBehaviour the container belongs to.

    Declaration
    void SetNetworkBehaviour(NetworkBehaviour behaviour)
    Parameters
    Type Name Description
    NetworkBehaviour behaviour

    The behaviour the container behaves to

    WriteDelta(Stream)

    Writes the dirty changes, that is, the changes since the variable was last dirty, to the writer

    Declaration
    void WriteDelta(Stream stream)
    Parameters
    Type Name Description
    Stream stream

    The stream to write the dirty changes to

    WriteField(Stream)

    Writes the complete state of the variable to the writer

    Declaration
    void WriteField(Stream stream)
    Parameters
    Type Name Description
    Stream stream

    The stream to write the state to

    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)