Skip to content

Commit 91fdad0

Browse files
test - fix
Fixing an issue where it was possible for the NetworkVisibility test to fail if it didn't wait long enough for the message to be processed and the player id removed from the NetworkSpawnManager.ObjectsToShowToClient table.
1 parent 6d5c59f commit 91fdad0

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

com.unity.netcode.gameobjects/Tests/Runtime/NetworkVisibilityTests.cs

+3-2
Original file line numberDiff line numberDiff line change
@@ -87,8 +87,9 @@ public IEnumerator HideShowAndDeleteTest()
8787
sessionOwnerNetworkObject.NetworkShow(m_ClientNetworkManagers[clientIndex].LocalClientId);
8888
sessionOwnerNetworkObject.Despawn(true);
8989

90-
// Expect no exceptions
91-
yield return s_DefaultWaitForTick;
90+
// Expect no exceptions while waiting to show the object and wait for the client id to be removed
91+
yield return WaitForConditionOrTimeOut(() => !m_SessionOwner.SpawnManager.ObjectsToShowToClient.ContainsKey(m_ClientNetworkManagers[clientIndex].LocalClientId));
92+
AssertOnTimeout($"Timed out waiting for client-{m_ClientNetworkManagers[clientIndex].LocalClientId} to be removed from the {nameof(NetworkSpawnManager.ObjectsToShowToClient)} table!");
9293

9394
// Now force a scenario where it normally would have caused an exception
9495
m_SessionOwner.SpawnManager.ObjectsToShowToClient.Add(m_ClientNetworkManagers[clientIndex].LocalClientId, new System.Collections.Generic.List<NetworkObject>());

0 commit comments

Comments
 (0)