mirror of
https://github.com/MirrorNetworking/Mirror.git
synced 2024-11-18 02:50:32 +00:00
perf: NetworkBehaviour.IsDirty: check bits before time
This commit is contained in:
parent
d05feed59e
commit
485b65f18d
@ -170,8 +170,10 @@ public void SetSyncVarDirtyBit(ulong dirtyBit)
|
||||
// OR both bitmasks. != 0 if either was dirty.
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public bool IsDirty() =>
|
||||
NetworkTime.localTime - lastSyncTime >= syncInterval &&
|
||||
(syncVarDirtyBits | syncObjectDirtyBits) != 0UL;
|
||||
// check bits first. this is basically free.
|
||||
(syncVarDirtyBits | syncObjectDirtyBits) != 0UL &&
|
||||
// only check time if bits were dirty. this is more expensive.
|
||||
NetworkTime.localTime - lastSyncTime >= syncInterval;
|
||||
|
||||
/// <summary>Clears all the dirty bits that were set by SetDirtyBits()</summary>
|
||||
// automatically invoked when an update is sent for this object, but can
|
||||
|
Loading…
Reference in New Issue
Block a user