From f730b61cb99e44101d609916f46c55b00b173d0b Mon Sep 17 00:00:00 2001 From: mischa Date: Sun, 14 Jul 2024 10:14:09 +0200 Subject: [PATCH] NetworkIdentity.DirtyMasks: syntax simplified --- Assets/Mirror/Core/NetworkIdentity.cs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/Assets/Mirror/Core/NetworkIdentity.cs b/Assets/Mirror/Core/NetworkIdentity.cs index aed8251f6..a9008dccb 100644 --- a/Assets/Mirror/Core/NetworkIdentity.cs +++ b/Assets/Mirror/Core/NetworkIdentity.cs @@ -844,9 +844,9 @@ internal void OnStopLocalPlayer() for (int i = 0; i < components.Length; ++i) { NetworkBehaviour component = components[i]; + ulong nthBit = (1u << i); bool dirty = component.IsDirty(); - ulong nthBit = (1u << i); // owner needs to be considered for both SyncModes, because // Observers mode always includes the Owner. @@ -888,11 +888,13 @@ ulong ClientDirtyMask() // on client, only consider owned components with SyncDirection to server NetworkBehaviour component = components[i]; + ulong nthBit = (1u << i); + if (isOwned && component.syncDirection == SyncDirection.ClientToServer) { // set the n-th bit if dirty // shifting from small to large numbers is varint-efficient. - if (component.IsDirty()) mask |= (1u << i); + if (component.IsDirty()) mask |= nthBit; } }