mirror of
https://github.com/MirrorNetworking/Mirror.git
synced 2024-11-18 02:50:32 +00:00
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:
parent
3fff51d4a1
commit
3a30dd84da
@ -18,7 +18,8 @@ public enum Operation : byte
|
|||||||
OP_ADD,
|
OP_ADD,
|
||||||
OP_CLEAR,
|
OP_CLEAR,
|
||||||
OP_REMOVE,
|
OP_REMOVE,
|
||||||
OP_SET
|
OP_SET,
|
||||||
|
OP_RENEW
|
||||||
}
|
}
|
||||||
|
|
||||||
struct Change
|
struct Change
|
||||||
@ -128,6 +129,8 @@ public override void OnSerializeDelta(NetworkWriter writer)
|
|||||||
break;
|
break;
|
||||||
case Operation.OP_CLEAR:
|
case Operation.OP_CLEAR:
|
||||||
break;
|
break;
|
||||||
|
case Operation.OP_RENEW:
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -151,6 +154,9 @@ public override void OnDeserializeAll(NetworkReader reader)
|
|||||||
// the next time the list is synchronized
|
// the next time the list is synchronized
|
||||||
// because they have already been applied
|
// because they have already been applied
|
||||||
changesAhead = (int)reader.ReadUInt();
|
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)
|
public override void OnDeserializeDelta(NetworkReader reader)
|
||||||
|
Loading…
Reference in New Issue
Block a user