Class MyCustomGenericNetworkVariable<T>
Bare minimum example of generic NetworkVariableBase derived class
Implements
Inherited Members
Namespace: DocumentationCodeSamples
Assembly: Unity.Netcode.Runtime.Tests.dll
Syntax
[Serializable]
[GenerateSerializationForGenericParameter(0)]
public class MyCustomGenericNetworkVariable<T> : NetworkVariableBase, IDisposable
Type Parameters
| Name | Description |
|---|---|
| T | Generic type marker |
Fields
SomeDataToSynchronize
Managed list of class instances
Declaration
public List<T> SomeDataToSynchronize
Field Value
| Type | Description |
|---|---|
| List<T> |
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
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
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
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 |