Skip to content

Commit d5d0dc7

Browse files
committed
WhenManyObjectsAreSpawnedAtOnce_AllAreReceived updated to its newer version from NGOv2.X branch
1 parent c59035b commit d5d0dc7

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

com.unity.netcode.gameobjects/Tests/Runtime/NetworkObject/NetworkObjectSpawnManyObjectsTests.cs

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -47,19 +47,23 @@ protected override void OnServerAndClientsCreated()
4747
}
4848

4949
[UnityTest]
50-
// When this test fails it does so without an exception and will wait the default ~6 minutes
51-
[Timeout(360000)] // Tracked in MTT-11360
5250
public IEnumerator WhenManyObjectsAreSpawnedAtOnce_AllAreReceived()
5351
{
52+
var timeStarted = Time.realtimeSinceStartup;
5453
for (int x = 0; x < k_SpawnedObjects; x++)
5554
{
5655
NetworkObject serverObject = Object.Instantiate(m_PrefabToSpawn.Prefab).GetComponent<NetworkObject>();
5756
serverObject.NetworkManagerOwner = m_ServerNetworkManager;
5857
serverObject.Spawn();
5958
}
59+
60+
var timeSpawned = Time.realtimeSinceStartup - timeStarted;
61+
// Provide plenty of time to spawn all 1500 objects in case the CI VM is running slow
62+
var timeoutHelper = new TimeoutHelper(30);
6063
// ensure all objects are replicated
61-
yield return WaitForConditionOrTimeOut(() => SpawnObjecTrackingComponent.SpawnedObjects == k_SpawnedObjects);
62-
AssertOnTimeout($"Timed out waiting for the client to spawn {k_SpawnedObjects} objects!");
64+
yield return WaitForConditionOrTimeOut(() => SpawnObjecTrackingComponent.SpawnedObjects == k_SpawnedObjects, timeoutHelper);
65+
66+
AssertOnTimeout($"Timed out waiting for the client to spawn {k_SpawnedObjects} objects! Time to spawn: {timeSpawned} | Time to timeout: {timeStarted - Time.realtimeSinceStartup}", timeoutHelper);
6367
}
6468
}
6569
}

0 commit comments

Comments
 (0)