From 3a30dd84da9726d2c9ffb7d88f277688a94f2cc7 Mon Sep 17 00:00:00 2001 From: Moddingdudes Date: Wed, 20 Sep 2023 22:01:48 -0400 Subject: [PATCH] fix: Add OP_RENEW to SyncDictionary When all SyncDictionary values are set simultaneously, this treats the serialization/deserialization as "all" instead of "delta" which means Callback will not be invoked, so you will miss data changes from the host. --- Assets/Mirror/Core/SyncDictionary.cs | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/Assets/Mirror/Core/SyncDictionary.cs b/Assets/Mirror/Core/SyncDictionary.cs index f0f052156..f12492e34 100644 --- a/Assets/Mirror/Core/SyncDictionary.cs +++ b/Assets/Mirror/Core/SyncDictionary.cs @@ -18,7 +18,8 @@ public enum Operation : byte OP_ADD, OP_CLEAR, OP_REMOVE, - OP_SET + OP_SET, + OP_RENEW } struct Change @@ -128,6 +129,8 @@ public override void OnSerializeDelta(NetworkWriter writer) break; case Operation.OP_CLEAR: break; + case Operation.OP_RENEW: + break; } } } @@ -151,6 +154,9 @@ public override void OnDeserializeAll(NetworkReader reader) // the next time the list is synchronized // because they have already been applied changesAhead = (int)reader.ReadUInt(); + + //Call OP_RENEW when all items have been changed. + AddOperation(Operation.OP_RENEW, default, default, false); } public override void OnDeserializeDelta(NetworkReader reader)