From 20b7e5326e5830447705a2c3885300a638ad1e7f Mon Sep 17 00:00:00 2001 From: vis2k Date: Sat, 8 Apr 2023 13:35:28 +0800 Subject: [PATCH] Weaver: update comments --- .../Editor/Weaver/Processors/CommandProcessor.cs | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/Assets/Mirror/Editor/Weaver/Processors/CommandProcessor.cs b/Assets/Mirror/Editor/Weaver/Processors/CommandProcessor.cs index 32ca0402c..0c05318e8 100644 --- a/Assets/Mirror/Editor/Weaver/Processors/CommandProcessor.cs +++ b/Assets/Mirror/Editor/Weaver/Processors/CommandProcessor.cs @@ -10,10 +10,11 @@ public static class CommandProcessor // generates code like: public void CmdThrust(float thrusting, int spin) { - NetworkWriter networkWriter = new NetworkWriter(); - networkWriter.Write(thrusting); - networkWriter.WritePackedUInt32((uint)spin); - base.SendCommandInternal(cmdName, networkWriter, channel); + NetworkWriterPooled writer = NetworkWriterPool.Get(); + writer.Write(thrusting); + writer.WritePackedUInt32((uint)spin); + base.SendCommandInternal(cmdName, cmdHash, writer, channel); + NetworkWriterPool.Return(writer); } public void CallCmdThrust(float thrusting, int spin) @@ -54,7 +55,7 @@ public static MethodDefinition ProcessCommandCall(WeaverTypes weaverTypes, Write worker.Emit(OpCodes.Ldstr, md.FullName); // pass the function hash so we don't have to compute it at runtime // otherwise each GetStableHash call requires O(N) complexity. - // noticeable for long function names: + // noticeable for long function names: // https://github.com/MirrorNetworking/Mirror/issues/3375 worker.Emit(OpCodes.Ldc_I4, md.FullName.GetStableHashCode()); // writer