Skip to content

Commit

Permalink
perf: update vars is now a value type (#990)
Browse files Browse the repository at this point in the history
  • Loading branch information
paulpach authored and miwarnec committed Jul 29, 2019
1 parent a32c5a9 commit f99e71e
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions Assets/Mirror/Runtime/Messages.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit f99e71e

Please sign in to comment.