Skip to main content

Unity.Netcode.NetworkVariableBase

Interface for network value containers

Inheritance#

System.Object

NetworkVariableBase

NetworkVariableSerialization\<T>

Implements#

System.IDisposable

Inherited Members#

System.Object.Equals(System.Object)

System.Object.Equals(System.Object, System.Object)

System.Object.GetHashCode()

System.Object.GetType()

System.Object.MemberwiseClone()

System.Object.ReferenceEquals(System.Object, System.Object)

System.Object.ToString()

Syntax#
public abstract class NetworkVariableBase : IDisposable

Constructors#

NetworkVariableBase(NetworkVariableReadPermission, NetworkVariableWritePermission)#

Declaration#
protected NetworkVariableBase(NetworkVariableReadPermission readPerm = NetworkVariableReadPermission.Everyone, NetworkVariableWritePermission writePerm = NetworkVariableWritePermission.Server)
Parameters#
TypeNameDescription
NetworkVariableReadPermissionreadPerm
NetworkVariableWritePermissionwritePerm

Fields#

DefaultReadPerm#

Declaration#
public const NetworkVariableReadPermission DefaultReadPerm = NetworkVariableReadPermission.Everyone
Field Value#
TypeDescription
NetworkVariableReadPermission

DefaultWritePerm#

Declaration#
public const NetworkVariableWritePermission DefaultWritePerm = NetworkVariableWritePermission.Server
Field Value#
TypeDescription
NetworkVariableWritePermission

ReadPerm#

The read permission for this var

Declaration#
public readonly NetworkVariableReadPermission ReadPerm
Field Value#
TypeDescription
NetworkVariableReadPermission

WritePerm#

Declaration#
public readonly NetworkVariableWritePermission WritePerm
Field Value#
TypeDescription
NetworkVariableWritePermission

Properties#

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

Methods#

CanClientRead(UInt64)#

Declaration#
public bool CanClientRead(ulong clientId)
Parameters#
TypeNameDescription
System.UInt64clientId
Returns#
TypeDescription
System.Boolean

CanClientWrite(UInt64)#

Declaration#
public bool CanClientWrite(ulong clientId)
Parameters#
TypeNameDescription
System.UInt64clientId
Returns#
TypeDescription
System.Boolean

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

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