Class NetworkBehaviourOnSynchronizeComponent
Inheritance
Inherited Members
Namespace: Unity.Netcode.RuntimeTests
Assembly: solution.dll
Syntax
public class NetworkBehaviourOnSynchronizeComponent : NetworkBehaviour
Fields
CustomSerializationData
Declaration
public NetworkBehaviourOnSynchronizeComponent.SomeCustomSerializationData CustomSerializationData
Field Value
Type | Description |
---|---|
NetworkBehaviourOnSynchronizeComponent.SomeCustomSerializationData |
Methods
OnNetworkSpawn()
Gets called when the NetworkObject gets spawned, message handlers are ready to be registered and the network is setup.
Declaration
public override void OnNetworkSpawn()
Overrides
OnSynchronize<T>(ref BufferSerializer<T>)
Override this method if your derived NetworkBehaviour requires custom synchronization data. Note: Use of this method is only for the initial client synchronization of NetworkBehaviours and will increase the payload size for client synchronization and dynamically spawned NetworkObjects.
Declaration
protected override void OnSynchronize<T>(ref BufferSerializer<T> serializer) where T : IReaderWriter
Parameters
Type | Name | Description |
---|---|---|
BufferSerializer<T> | serializer | The serializer to use to read and write the data. |
Type Parameters
Name | Description |
---|---|
T | Either BufferSerializerReader or BufferSerializerWriter, depending whether the serializer is in read mode or write mode. |
Overrides
Remarks
When serializing (writing) this will be invoked during the client synchronization period and when spawning new NetworkObjects. When deserializing (reading), this will be invoked prior to the NetworkBehaviour's associated NetworkObject being spawned.