Skip to main content

Unity.Netcode.NetworkVariableBase

Interface for network value containers

Inheritance#

System.Dynamic.ExpandoObject

System.Dynamic.ExpandoObject

System.Dynamic.ExpandoObject

System.Dynamic.ExpandoObject

Implements#

System.IDisposable

Inherited Members#

Object.Equals(Object)

Object.Equals(Object, Object)

Object.GetHashCode()

Object.GetType()

Object.MemberwiseClone()

Object.ReferenceEquals(Object, Object)

Object.ToString()

Namespace: System.Dynamic.ExpandoObject#
Assembly: MLAPI.dll#
Syntax#
public abstract class NetworkVariableBase : IDisposable

NetworkVariableBase(NetworkVariableReadPermission)#

Declaration#

protected NetworkVariableBase(NetworkVariableReadPermission readPermIn = NetworkVariableReadPermission.Everyone)

Parameters#

TypeNameDescription
NetworkVariableReadPermissionreadPermIn

#

ReadPerm#

The read permission for this var

Declaration#

public readonly NetworkVariableReadPermission ReadPerm

Field Value#

TypeDescription
NetworkVariableReadPermission

#

Name#

Gets or sets the name of the network variable's instance (MemberInfo) where it was declared.

Declaration#

public string Name { get; }

Property Value#

TypeDescription
System.String

#

CanClientRead(UInt64)#

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

Declaration#

public bool CanClientRead(ulong clientId)

Parameters#

TypeNameDescription
System.UInt64clientIdThe clientId of the remote client

Returns#

TypeDescription
System.BooleanWhether or not the client can read to the variable

Dispose()#

Declaration#

public virtual void Dispose()

Initialize(NetworkBehaviour)#

Declaration#

public void Initialize(NetworkBehaviour networkBehaviour)

Parameters#

TypeNameDescription
NetworkBehaviournetworkBehaviour

IsDirty()#

Gets Whether or not the container is dirty

Declaration#

public virtual bool IsDirty()

Returns#

TypeDescription
System.BooleanWhether or not the container is dirty

ReadDelta(FastBufferReader, Boolean)#

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

Declaration#

public abstract void ReadDelta(FastBufferReader reader, bool keepDirtyDelta)

Parameters#

TypeNameDescription
FastBufferReaderreaderThe stream to read the delta from
System.BooleankeepDirtyDeltaWhether or not the delta should be kept as dirty or consumed

ReadField(FastBufferReader)#

Reads the complete state from the reader and applies it

Declaration#

public abstract void ReadField(FastBufferReader reader)

Parameters#

TypeNameDescription
FastBufferReaderreaderThe stream to read the state from

ResetDirty()#

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

Declaration#

public virtual void ResetDirty()

SetDirty(Boolean)#

Sets whether or not the variable needs to be delta synced

Declaration#

public virtual void SetDirty(bool isDirty)

Parameters#

TypeNameDescription
System.BooleanisDirty

ShouldWrite(UInt64, Boolean)#

Declaration#

public virtual bool ShouldWrite(ulong clientId, bool isServer)

Parameters#

TypeNameDescription
System.UInt64clientId
System.BooleanisServer

Returns#

TypeDescription
System.Boolean

WriteDelta(FastBufferWriter)#

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

Declaration#

public abstract void WriteDelta(FastBufferWriter writer)

Parameters#

TypeNameDescription
FastBufferWriterwriterThe stream to write the dirty changes to

WriteField(FastBufferWriter)#

Writes the complete state of the variable to the writer

Declaration#

public abstract void WriteField(FastBufferWriter writer)

Parameters#

TypeNameDescription
FastBufferWriterwriterThe stream to write the state to

Implements#

System.IDisposable