Method OnSynchronize
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 virtual 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. |
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.