Skip to main content

Interface ISyncObject

A sync object is an object that can synchronize it's state between server and client, such as a SyncList

Syntax​
public interface ISyncObject

Properties​

IsDirty​

true if there are changes since the last flush

Declaration​
bool IsDirty { get; }

Methods​

SetShouldSyncFrom(Boolean)​

Are we sending or receiving data from this instance. This is used to determine if we should throw if a change is made on the wrong instance

Declaration​
void SetShouldSyncFrom(bool shouldSync)
Parameters​
TypeNameDescription
System.BooleanshouldSync

Flush()​

Discard all the queued changes Consider the object fully synchronized with clients

Declaration​
void Flush()

OnSerializeAll(NetworkWriter)​

Write a full copy of the object

Declaration​
void OnSerializeAll(NetworkWriter writer)
Parameters​
TypeNameDescription
Mirage.Serialization.NetworkWriterwriter

OnSerializeDelta(NetworkWriter)​

Write the changes made to the object since last sync

Declaration​
void OnSerializeDelta(NetworkWriter writer)
Parameters​
TypeNameDescription
Mirage.Serialization.NetworkWriterwriter

OnDeserializeAll(NetworkReader)​

Reads a full copy of the object

Declaration​
void OnDeserializeAll(NetworkReader reader)
Parameters​
TypeNameDescription
Mirage.Serialization.NetworkReaderreader

OnDeserializeDelta(NetworkReader)​

Reads the changes made to the object since last sync

Declaration​
void OnDeserializeDelta(NetworkReader reader)
Parameters​
TypeNameDescription
Mirage.Serialization.NetworkReaderreader

Reset()​

Resets the SyncObject so that it can be re-used

Declaration​
void Reset()

SetNetworkBehaviour(NetworkBehaviour)​

Sets the NetworkBehaviour that owns this SyncObject This can be used by custom syncObjects to listen to events on NetworkBehaviour This will only be called once, the first time the object is spawned (similar to unity's awake call)

Declaration​
void SetNetworkBehaviour(NetworkBehaviour networkBehaviour)
Parameters​
TypeNameDescription
Mirage.NetworkBehaviournetworkBehaviour