removing cahced field (#1641)

This commit is contained in:
James Frowen 2020-04-02 17:49:38 +01:00 committed by GitHub
parent 4d5cee893d
commit 456fde07bc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1233,10 +1233,6 @@ internal void Reset()
ClearObservers();
}
// MirrorUpdate is a hot path. Caching the vars msg is really worth it to
// avoid large amounts of allocations.
static UpdateVarsMessage varsMessage = new UpdateVarsMessage();
// invoked by NetworkServer during Update()
internal void ServerUpdate()
{
@ -1249,8 +1245,10 @@ internal void ServerUpdate()
OnSerializeAllSafely(false, ownerWriter, out int ownerWritten, observersWriter, out int observersWritten);
if (ownerWritten > 0 || observersWritten > 0)
{
// populate cached UpdateVarsMessage and send
varsMessage.netId = netId;
UpdateVarsMessage varsMessage = new UpdateVarsMessage
{
netId = netId
};
// send ownerWriter to owner
// (only if we serialized anything for owner)