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.
This commit is contained in:
Moddingdudes 2023-09-20 22:01:48 -04:00 committed by GitHub
parent 3fff51d4a1
commit 3a30dd84da
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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)