Bug
When a NetworkList<T>.Add() is performed on the server during a newly-spawned NetworkObject's OnNetworkSpawn, the joining client receives the new entry twice — once via the spawn snapshot (WriteFieldSynchronization) and again as a queued delta (WriteDelta → EventType.Add). Other peers see the list correctly.
Why it happens
PR #3878 deleted this override from Runtime/NetworkVariable/Collections/NetworkList.cs:
internal override void OnSpawned()
{
if (IsDirty() && CanSend() && m_NetworkObject.IsSpawnAuthority)
{
UpdateLastSentTime();
ResetDirty();
SetDirty(false);
}
base.OnSpawned();
}
Its own comment said it existed "to prevent duplicate entries from being sent (i.e. CreateObjectMessage will contain the changes so we don't need to send a proceeding NetworkVariableDeltaMessage)."
PR #3878 moved this logic into NetworkVariableBase.InternalOnSpawned() intending to make it universal, but the new predicate adds a CanWrite() check that wasn't in the original, and that check is what's now excluding server-write NetworkList in the spawn-time path.
Fix
Restore NetworkList<T>.OnSpawned(), or change the predicate in NetworkVariableBase.InternalOnSpawned() to match the deleted version (IsDirty() && CanSend() && IsSpawnAuthority).
Versions tested
- 2.9.1 Works Properly
- 2.9.2 and 2.11.2 Broken. Same Issue.
Bug
When a
NetworkList<T>.Add()is performed on the server during a newly-spawnedNetworkObject'sOnNetworkSpawn, the joining client receives the new entry twice — once via the spawn snapshot (WriteFieldSynchronization) and again as a queued delta (WriteDelta→EventType.Add). Other peers see the list correctly.Why it happens
PR #3878 deleted this override from
Runtime/NetworkVariable/Collections/NetworkList.cs:Its own comment said it existed "to prevent duplicate entries from being sent (i.e. CreateObjectMessage will contain the changes so we don't need to send a proceeding NetworkVariableDeltaMessage)."
PR #3878 moved this logic into NetworkVariableBase.InternalOnSpawned() intending to make it universal, but the new predicate adds a CanWrite() check that wasn't in the original, and that check is what's now excluding server-write NetworkList in the spawn-time path.
Fix
Restore
NetworkList<T>.OnSpawned(), or change the predicate inNetworkVariableBase.InternalOnSpawned()to match the deleted version (IsDirty() && CanSend() && IsSpawnAuthority).Versions tested