NetworkIdentity.DirtyMasks: syntax simplified further

This commit is contained in:
mischa 2024-07-14 10:18:36 +02:00
parent f730b61cb9
commit 04e875ab6c

View File

@ -857,15 +857,18 @@ internal void OnStopLocalPlayer()
if (initialState || (component.syncDirection == SyncDirection.ServerToClient && dirty)) if (initialState || (component.syncDirection == SyncDirection.ServerToClient && dirty))
ownerMask |= nthBit; ownerMask |= nthBit;
// observers need to be considered only in Observers mode // observers need to be considered only in Observers mode,
// // otherwise they receive no sync data of this component ever.
if (component.syncMode == SyncMode.Observers)
{
// for initial, it should always sync to observers. // for initial, it should always sync to observers.
// for delta, only if dirty. // for delta, only if dirty.
// SyncDirection is irrelevant, as both are broadcast to // SyncDirection is irrelevant, as both are broadcast to
// observers which aren't the owner. // observers which aren't the owner.
if (component.syncMode == SyncMode.Observers && (initialState || dirty)) if (initialState || dirty)
observerMask |= nthBit; observerMask |= nthBit;
} }
}
return (ownerMask, observerMask); return (ownerMask, observerMask);
} }