Sync Property
For synchronizing not frequently updated GameObject States
Last updated
For synchronizing not frequently updated GameObject States
Last updated
Sync Properties are created in the Unity Editor Inspector by clicking the Add Sync Property button.
You can have up to 250 Sync Properties in one Sync Property Agent.
Maximum message size of a syncProperty is 4KB.
Name
Function
Name
Unique name of the Sync Property. Sync Property name must be unique in the same Sync Property Agent Component.
Type
Bool: Bool Property
Float: Float Property
Int: Int Property
String: String Property
Vector 3: Vector 3 Property
Vector 2: Vector 2 Property
Serializable: Serializable Property
TinyJSON: Any class and struct property
Conflict Resolution
Mine: takes the local change
Their: takes the remote change
Custom: use a custom method to resolve the conflict
Data
The current value of the Sync Property
Version
The current Version of the Sync Property
Event
Description
OnValueChange
Invoked when the Sync Property is modified.
OnConflict
Invoked when conflict occurs and Conflict Resolution is set to Custom.
OnReady
invoked when the Sync Property finished fetching its value from the game server and is ready to be used.
Sync Properties can be modified by calling SWNetwork API in C# scripts
Modify Sync Property
Get Sync Property
Read Sync property values
In this example, an Int Synced Property of name "hp" is modified.
To get updates when a SyncProperty is modified, you can add a handler to the OnValueChange event of the SyncProperty.