Skip to content

fix: Replaced HashSet.UnionWith() with loop in NetworkBehaviourUpdate() to avoid heap alloc #3561

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,10 @@ internal void NetworkBehaviourUpdate(bool forceSend = false)
#endif
try
{
m_DirtyNetworkObjects.UnionWith(m_PendingDirtyNetworkObjects);
foreach (var o in m_PendingDirtyNetworkObjects)
{
m_DirtyNetworkObjects.Add(o);
}
m_PendingDirtyNetworkObjects.Clear();

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