mirror of
https://github.com/MirrorNetworking/Mirror.git
synced 2024-11-18 11:00:32 +00:00
Update sync/index.md
This commit is contained in:
parent
e28734e643
commit
2f4bcdf64d
@ -62,7 +62,7 @@ Use the `initialState` flag to differentiate between the first time a game objec
|
|||||||
|
|
||||||
The `OnSerialize` function should return true to indicate that an update should be sent. If it returns true, the dirty bits for that script are set to zero. If it returns false, the dirty bits are not changed. This allows multiple changes to a script to be accumulated over time and sent when the system is ready, instead of every frame.
|
The `OnSerialize` function should return true to indicate that an update should be sent. If it returns true, the dirty bits for that script are set to zero. If it returns false, the dirty bits are not changed. This allows multiple changes to a script to be accumulated over time and sent when the system is ready, instead of every frame.
|
||||||
|
|
||||||
The `OnSerialize` function is only called for `initialState` or when the `NetworkBehavior` is dirty. A `NetworkBehavior` will only be dirty if a `SyncVar` or `SyncObject` (e.g. `SyncList`) has changed since the last OnSerialize call. After data has been sent the `NetworkBehavior` will not be dirty again until the next `syncInterval` (set in the inspector). A `NetworkBehavior` can also be marked as dirty by manually calling `SetDirtyBit` (this does not bypass the syncInterval limit).
|
The `OnSerialize` function is only called for `initialState` or when the `NetworkBehaviour` is dirty. A `NetworkBehaviour` will only be dirty if a `SyncVar` or `SyncObject` (e.g. `SyncList`) has changed since the last OnSerialize call. After data has been sent the `NetworkBehaviour` will not be dirty again until the next `syncInterval` (set in the inspector). A `NetworkBehaviour` can also be marked as dirty by manually calling `SetDirtyBit` (this does not bypass the syncInterval limit).
|
||||||
|
|
||||||
Although this works, it is usually better to let Mirror generate these methods and provide [custom serializers](../DataTypes.md) for your specific field.
|
Although this works, it is usually better to let Mirror generate these methods and provide [custom serializers](../DataTypes.md) for your specific field.
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user