diff --git a/Assets/Mirror/Tests/Editor/NetworkBehaviourDirtyBitsTests.cs b/Assets/Mirror/Tests/Editor/NetworkBehaviourDirtyBitsTests.cs index 6650e2a96..dbd32a44b 100644 --- a/Assets/Mirror/Tests/Editor/NetworkBehaviourDirtyBitsTests.cs +++ b/Assets/Mirror/Tests/Editor/NetworkBehaviourDirtyBitsTests.cs @@ -66,6 +66,25 @@ public void AnySyncObjectDirty() Assert.That(comp.AnySyncObjectDirty(), Is.True); } + [Test] + public void IsDirty() + { + CreateNetworked(out GameObject _, out NetworkIdentity _, out NetworkBehaviourWithSyncVarsAndCollections comp); + + // not dirty by default + Assert.That(comp.IsDirty(), Is.False); + + // changing a [SyncVar] should set it dirty + ++comp.health; + Assert.That(comp.IsDirty(), Is.True); + comp.ClearAllDirtyBits(); + + // changing a SyncCollection should set it dirty + comp.list.Add(42); + Assert.That(comp.IsDirty(), Is.True); + comp.ClearAllDirtyBits(); + } + [Test] public void ClearAllDirtyBitsClearsSyncVarDirtyBits() {