From 394ba40310f3d39bf142a19bd5e911f194cae69c Mon Sep 17 00:00:00 2001 From: mischa Date: Mon, 15 Jul 2024 12:57:51 +0200 Subject: [PATCH] NetworkIdentitySerialization: Reset() function for convenience --- Assets/Mirror/Core/NetworkIdentity.cs | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/Assets/Mirror/Core/NetworkIdentity.cs b/Assets/Mirror/Core/NetworkIdentity.cs index 645c024f7..6148a478f 100644 --- a/Assets/Mirror/Core/NetworkIdentity.cs +++ b/Assets/Mirror/Core/NetworkIdentity.cs @@ -29,6 +29,12 @@ public struct NetworkIdentitySerialization public int tick; public NetworkWriter ownerWriter; public NetworkWriter observersWriter; + + public void ResetWriters() + { + ownerWriter.Position = 0; + observersWriter.Position = 0; + } } /// NetworkIdentity identifies objects across the network. @@ -1131,8 +1137,7 @@ internal NetworkIdentitySerialization GetServerSerializationAtTick(int tick) ) { // reset - lastSerialization.ownerWriter.Position = 0; - lastSerialization.observersWriter.Position = 0; + lastSerialization.ResetWriters(); // serialize SerializeServer(false,