diff --git a/Assets/Mirror/Runtime/NetworkConnection.cs b/Assets/Mirror/Runtime/NetworkConnection.cs index 59914b9aa..4b00eb700 100644 --- a/Assets/Mirror/Runtime/NetworkConnection.cs +++ b/Assets/Mirror/Runtime/NetworkConnection.cs @@ -133,9 +133,10 @@ public void Send(T msg, int channelId = Channels.Reliable) // => it's important to log errors, so the user knows what went wrong. protected static bool ValidatePacketSize(ArraySegment segment, int channelId) { - if (segment.Count > Transport.activeTransport.GetMaxPacketSize(channelId)) + int max = Transport.activeTransport.GetMaxPacketSize(channelId); + if (segment.Count > max) { - Debug.LogError($"NetworkConnection.ValidatePacketSize: cannot send packet larger than {Transport.activeTransport.GetMaxPacketSize(channelId)} bytes, was {segment.Count} bytes"); + Debug.LogError($"NetworkConnection.ValidatePacketSize: cannot send packet larger than {max} bytes, was {segment.Count} bytes"); return false; }