From 2f5ce11491a28667f1c5fbcf1fe8fea262564834 Mon Sep 17 00:00:00 2001 From: vis2k Date: Wed, 9 Jun 2021 21:13:30 +0800 Subject: [PATCH] NetworkReaderPool: use NetworkReader.SetBuffer --- Assets/Mirror/Runtime/NetworkReaderPool.cs | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/Assets/Mirror/Runtime/NetworkReaderPool.cs b/Assets/Mirror/Runtime/NetworkReaderPool.cs index b5591bad6..c410c603a 100644 --- a/Assets/Mirror/Runtime/NetworkReaderPool.cs +++ b/Assets/Mirror/Runtime/NetworkReaderPool.cs @@ -28,8 +28,7 @@ public static PooledNetworkReader GetReader(byte[] bytes) { // grab from pool & set buffer PooledNetworkReader reader = Pool.Take(); - reader.buffer = new ArraySegment(bytes); - reader.Position = 0; + reader.SetBuffer(bytes); return reader; } @@ -38,8 +37,7 @@ public static PooledNetworkReader GetReader(ArraySegment segment) { // grab from pool & set buffer PooledNetworkReader reader = Pool.Take(); - reader.buffer = segment; - reader.Position = 0; + reader.SetBuffer(segment); return reader; }