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
Type | Name | Description |
---|---|---|
System.Boolean | shouldSync |
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
Type | Name | Description |
---|---|---|
Mirage.Serialization.NetworkWriter | writer |
OnSerializeDelta(NetworkWriter)
Write the changes made to the object since last sync
Declaration
void OnSerializeDelta(NetworkWriter writer)
Parameters
Type | Name | Description |
---|---|---|
Mirage.Serialization.NetworkWriter | writer |
OnDeserializeAll(NetworkReader)
Reads a full copy of the object
Declaration
void OnDeserializeAll(NetworkReader reader)
Parameters
Type | Name | Description |
---|---|---|
Mirage.Serialization.NetworkReader | reader |
OnDeserializeDelta(NetworkReader)
Reads the changes made to the object since last sync
Declaration
void OnDeserializeDelta(NetworkReader reader)
Parameters
Type | Name | Description |
---|---|---|
Mirage.Serialization.NetworkReader | reader |
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
Type | Name | Description |
---|---|---|
Mirage.NetworkBehaviour | networkBehaviour |