Improve the wiki
The MLAPI is free and open source. If you find anything missing from the wiki. Please help us improve this page to benefit everyone.
SyncedVar
SyncedVars are simple ways to have syncronized fields in NetworkedBehaviours. SyncedVars are similar to NetworkedVars but have a few differences:
- They are slower
- They are less customizable
- They only sync from server to client
- They require less code
- They support serialization
Example
Creating a SyncedVar is as easy as creating an attribute on the field. Note that properties are not supported.
[SyncedVar]
public float mySyncedFloat = 5f;
Single Sync Values
If you want values to be synced only once (at spawn), the send rate can be set to a negative value.
- Previous
- Next