NetworkIdentitySerialization: Reset() function for convenience

This commit is contained in:
mischa 2024-07-15 12:57:51 +02:00
parent 04e875ab6c
commit 394ba40310

View File

@ -29,6 +29,12 @@ public struct NetworkIdentitySerialization
public int tick; public int tick;
public NetworkWriter ownerWriter; public NetworkWriter ownerWriter;
public NetworkWriter observersWriter; public NetworkWriter observersWriter;
public void ResetWriters()
{
ownerWriter.Position = 0;
observersWriter.Position = 0;
}
} }
/// <summary>NetworkIdentity identifies objects across the network.</summary> /// <summary>NetworkIdentity identifies objects across the network.</summary>
@ -1131,8 +1137,7 @@ internal NetworkIdentitySerialization GetServerSerializationAtTick(int tick)
) )
{ {
// reset // reset
lastSerialization.ownerWriter.Position = 0; lastSerialization.ResetWriters();
lastSerialization.observersWriter.Position = 0;
// serialize // serialize
SerializeServer(false, SerializeServer(false,