Skip to content

Commit 722eee0

Browse files
test: assert the fixed update registration baseline before transferring ownership
Without it the post-transfer check passes whether the NetworkObject was unregistered or was never registered for the fixed update to begin with, so it could not tell a transition apart from nothing having happened.
1 parent b3e3545 commit 722eee0

1 file changed

Lines changed: 4 additions & 0 deletions

File tree

‎com.unity.netcode.gameobjects/Tests/Runtime/NetworkTransform/NetworkTransformMixedMotionModelTests.cs‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,10 @@ public IEnumerator UpdateRegistrationFollowsMotionModel()
4949
AssertOnTimeout($"Failed to spawn {instance.name} on all clients!");
5050

5151
var newOwner = m_ClientNetworkManagers[0];
52+
53+
// Establish the baseline before ownership is transferred, otherwise the check below would still pass if this instance was never registered for the fixed update to begin with.
54+
Assert.True(newOwner.NetworkTransformFixedUpdate.ContainsKey(instance.NetworkObjectId), $"Client-{newOwner.LocalClientId} should initially be registered for the fixed update!");
55+
5256
instance.ChangeOwnership(newOwner.LocalClientId);
5357
yield return WaitForConditionOrTimeOut(() => newOwner.SpawnManager.SpawnedObjects[instance.NetworkObjectId].OwnerClientId == newOwner.LocalClientId);
5458
AssertOnTimeout($"Client-{newOwner.LocalClientId} never gained ownership of {instance.name}!");

0 commit comments

Comments
 (0)