perf: update vars is now a value type (#990)

This commit is contained in:
Paul Pacheco 2019-07-29 08:52:35 -05:00 committed by vis2k
parent a32c5a9456
commit f99e71ebdf

View File

@ -369,20 +369,20 @@ public void Serialize(NetworkWriter writer)
}
}
class UpdateVarsMessage : MessageBase
struct UpdateVarsMessage : IMessageBase
{
public uint netId;
// the serialized component data
// -> ArraySegment to avoid unnecessary allocations
public ArraySegment<byte> payload;
public override void Deserialize(NetworkReader reader)
public void Deserialize(NetworkReader reader)
{
netId = reader.ReadPackedUInt32();
payload = reader.ReadBytesAndSizeSegment();
}
public override void Serialize(NetworkWriter writer)
public void Serialize(NetworkWriter writer)
{
writer.WritePackedUInt32(netId);
writer.WriteBytesAndSizeSegment(payload);