perf: Use NetworkWriterPool in NetworkAnimator (#1421)

This commit is contained in:
MrGadget 2020-01-10 19:10:06 -05:00 committed by Paul Pacheco
parent a4578458a1
commit 7d472f21f9

View File

@ -88,10 +88,11 @@ void FixedUpdate()
continue;
}
NetworkWriter writer = new NetworkWriter();
NetworkWriter writer = NetworkWriterPool.GetWriter();
WriteParameters(writer);
SendAnimationMessage(stateHash, normalizedTime, i, writer.ToArray());
NetworkWriterPool.Recycle(writer);
}
}
@ -136,11 +137,12 @@ void CheckSendRate()
{
sendTimer = Time.time + syncInterval;
NetworkWriter writer = new NetworkWriter();
NetworkWriter writer = NetworkWriterPool.GetWriter();
if (WriteParameters(writer))
{
SendAnimationParametersMessage(writer.ToArray());
}
NetworkWriterPool.Recycle(writer);
}
}