From 1baadc1dbeefc02704bcf0b56ec74a9f9cbe1f41 Mon Sep 17 00:00:00 2001 From: vis2k Date: Sun, 25 Sep 2022 12:08:13 +0700 Subject: [PATCH] syntax & comments --- Assets/Mirror/Core/MessagePacking.cs | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/Assets/Mirror/Core/MessagePacking.cs b/Assets/Mirror/Core/MessagePacking.cs index ed66d564b..643879d82 100644 --- a/Assets/Mirror/Core/MessagePacking.cs +++ b/Assets/Mirror/Core/MessagePacking.cs @@ -50,22 +50,20 @@ public static void Pack(T message, NetworkWriter writer) writer.Write(message); } - // unpack message after receiving - // -> pass NetworkReader so it's less strange if we create it in here - // and pass it upwards. - // -> NetworkReader will point at content afterwards! + // read only the message id. + // common function in case we ever change the header size. [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static bool Unpack(NetworkReader messageReader, out ushort msgType) + public static bool Unpack(NetworkReader reader, out ushort messageId) { // read message type try { - msgType = messageReader.ReadUShort(); + messageId = reader.ReadUShort(); return true; } catch (System.IO.EndOfStreamException) { - msgType = 0; + messageId = 0; return false; } }