docs.unity3d.com
Search Results for

    Show / Hide Table of Contents

    Class NetworkVariable<T>

    A variable that can be synchronized over the network.

    Inheritance
    object
    NetworkVariableBase
    NetworkVariable<T>
    NetworkVariableMiddleclass<TMiddleclassName>
    Implements
    IDisposable
    Inherited Members
    NetworkVariableBase.GetBehaviour()
    NetworkVariableBase.Initialize(NetworkBehaviour)
    NetworkVariableBase.DefaultReadPerm
    NetworkVariableBase.DefaultWritePerm
    NetworkVariableBase.Name
    NetworkVariableBase.ReadPerm
    NetworkVariableBase.WritePerm
    NetworkVariableBase.SetDirty(bool)
    NetworkVariableBase.MarkNetworkBehaviourDirty()
    NetworkVariableBase.CanClientRead(ulong)
    NetworkVariableBase.CanClientWrite(ulong)
    object.ToString()
    object.Equals(object)
    object.Equals(object, object)
    object.ReferenceEquals(object, object)
    object.GetHashCode()
    object.GetType()
    object.MemberwiseClone()
    Namespace: Unity.Netcode
    Assembly: solution.dll
    Syntax
    [Serializable]
    [GenerateSerializationForGenericParameter(0)]
    public class NetworkVariable<T> : NetworkVariableBase, IDisposable
    Type Parameters
    Name Description
    T

    the unmanaged type for NetworkVariable<T>

    Constructors

    Name Description
    NetworkVariable(T, NetworkVariableReadPermission, NetworkVariableWritePermission)

    Constructor for NetworkVariable<T>

    Fields

    Name Description
    OnValueChanged

    The callback to be invoked when the value gets changed

    Properties

    Name Description
    Value

    The value of the NetworkVariable container

    Methods

    Name Description
    Dispose()

    Virtual IDisposable implementation

    ~NetworkVariable()
    IsDirty()

    Gets Whether or not the container is dirty

    ReadDelta(FastBufferReader, bool)

    Reads value from the reader and applies it

    ReadField(FastBufferReader)

    Reads the complete state from the reader and applies it

    ResetDirty()

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

    WriteDelta(FastBufferWriter)

    Writes the variable to the writer

    WriteField(FastBufferWriter)

    Writes the complete state of the variable to the writer

    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)