mirror of
https://github.com/MirrorNetworking/Mirror.git
synced 2024-11-18 02:50:32 +00:00
docs: replacing paragraph on return with is dirty (#1987)
* replacing paragraph on return with is dirty the return value is not currently used in mirror OnSerialize is currently only called when IsDrity is true * Update doc/Guides/Sync/index.md Co-authored-by: MrGadget <chris@clevertech.net>
This commit is contained in:
parent
acbb0db6f3
commit
784b626dca
@ -61,8 +61,8 @@ Use the `initialState` flag to differentiate between the first time a game objec
|
||||
|
||||
If a class has SyncVars, then implementations of these functions are added automatically to the class, meaning that a class that has SyncVars cannot also have custom serialization functions.
|
||||
|
||||
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).
|
||||
|
||||
Although this works, it is usually better to let Mirror generate these methods and provide [custom serializers](../DataTypes.md) for your specific field.
|
||||
|
||||
## Serialization Flow
|
||||
|
Loading…
Reference in New Issue
Block a user