Skip to content

Commit 97737be

Browse files
louismclaughlinEmandM
authored andcommitted
Replaced HashSet.UnionWith() with loop to avoid heap alloc
1 parent 0e04623 commit 97737be

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

com.unity.netcode.gameobjects/Runtime/Core/NetworkBehaviourUpdater.cs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,10 @@ internal void NetworkBehaviourUpdate(bool forceSend = false)
3434
#endif
3535
try
3636
{
37-
m_DirtyNetworkObjects.UnionWith(m_PendingDirtyNetworkObjects);
37+
foreach (var o in m_PendingDirtyNetworkObjects)
38+
{
39+
m_DirtyNetworkObjects.Add(o);
40+
}
3841
m_PendingDirtyNetworkObjects.Clear();
3942

4043
// NetworkObject references can become null, when hidden or despawned. Once NUll, there is no point

0 commit comments

Comments
 (0)