diff --git a/Assets/Mirror/Runtime/NetworkBehaviour.cs b/Assets/Mirror/Runtime/NetworkBehaviour.cs index 93d865883..288d107df 100644 --- a/Assets/Mirror/Runtime/NetworkBehaviour.cs +++ b/Assets/Mirror/Runtime/NetworkBehaviour.cs @@ -394,7 +394,13 @@ public void ClearAllDirtyBits() syncVarDirtyBits = 0L; // flush all unsynchronized changes in syncobjects - m_SyncObjects.ForEach(obj => obj.Flush()); + // note: don't use List.ForEach here, this is a hot path + // List.ForEach: 432b/frame + // for: 231b/frame + for (int i = 0; i < m_SyncObjects.Count; ++i) + { + m_SyncObjects[i].Flush(); + } } internal bool AnySyncObjectDirty()