Skip to content

Commit

Permalink
perf: reduce allocation sending to observers
Browse files Browse the repository at this point in the history
  • Loading branch information
paulpach committed Oct 15, 2020
1 parent f4c943a commit f5f7f6c
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion Assets/Mirror/Runtime/NetworkServer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -356,6 +356,9 @@ internal void ActivateHostScene()
}
}


List<INetworkConnection> connectionsExcludeSelf = new List<INetworkConnection>(100);

/// <summary>
/// this is like SendToReady - but it doesn't check the ready flag on the connection.
/// this is used for ObjectDestroy messages.
Expand All @@ -377,7 +380,7 @@ internal void SendToObservers<T>(NetworkIdentity identity, T msg, bool includeOw
}
else
{
var connectionsExcludeSelf = new HashSet<INetworkConnection>();
connectionsExcludeSelf.Clear();
foreach(INetworkConnection conn in identity.observers)
{
if(identity.ConnectionToClient != conn)
Expand Down

0 comments on commit f5f7f6c

Please sign in to comment.