Skip to content

Commit c9a4846

Browse files
committed
Apply feedback
1 parent b65e33a commit c9a4846

File tree

1 file changed

+14
-4
lines changed

1 file changed

+14
-4
lines changed

com.unity.netcode.gameobjects/Tests/Runtime/TestHelpers/NetcodeIntegrationTest.cs

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1910,13 +1910,11 @@ protected IEnumerator WaitForConditionOrTimeOut(Func<StringBuilder, bool> checkF
19101910
/// <summary>
19111911
/// Waits until the given NetworkObject is spawned on all clients or a timeout occurs.
19121912
/// </summary>
1913-
/// <param name="instanceNetworkObject">The <see cref="NetworkObject"/> to watch for.</param>
1913+
/// <param name="networkObjectId">The id of the<see cref="NetworkObject"/> to wait for.</param>
19141914
/// <param name="timeOutHelper">An optional <see cref="TimeoutHelper"/> to control the timeout period. If null, the default timeout is used.</param>
19151915
/// <returns>An <see cref="IEnumerator"/> for use in Unity coroutines.</returns>
1916-
protected IEnumerator WaitForSpawnedOnAllOrTimeOut(NetworkObject instanceNetworkObject, TimeoutHelper timeOutHelper = null)
1916+
protected IEnumerator WaitForSpawnedOnAllOrTimeOut(ulong networkObjectId, TimeoutHelper timeOutHelper = null)
19171917
{
1918-
var networkObjectId = instanceNetworkObject.GetComponent<NetworkObject>().NetworkObjectId;
1919-
19201918
bool ValidateObjectSpawnedOnAllClients(StringBuilder errorLog)
19211919
{
19221920
foreach (var client in m_NetworkManagers)
@@ -1933,6 +1931,18 @@ bool ValidateObjectSpawnedOnAllClients(StringBuilder errorLog)
19331931
yield return WaitForConditionOrTimeOut(ValidateObjectSpawnedOnAllClients, timeOutHelper);
19341932
}
19351933

1934+
/// <summary>
1935+
/// Waits until the given NetworkObject is spawned on all clients or a timeout occurs.
1936+
/// </summary>
1937+
/// <param name="networkObject">The <see cref="NetworkObject"/> to wait for.</param>
1938+
/// <param name="timeOutHelper">An optional <see cref="TimeoutHelper"/> to control the timeout period. If null, the default timeout is used.</param>
1939+
/// <returns>An <see cref="IEnumerator"/> for use in Unity coroutines.</returns>
1940+
protected IEnumerator WaitForSpawnedOnAllOrTimeOut(NetworkObject networkObject, TimeoutHelper timeOutHelper = null)
1941+
{
1942+
var networkObjectId = networkObject.GetComponent<NetworkObject>().NetworkObjectId;
1943+
yield return WaitForSpawnedOnAllOrTimeOut(networkObjectId, timeOutHelper);
1944+
}
1945+
19361946
/// <summary>
19371947
/// Validates that all remote clients (i.e. non-server) detect they are connected
19381948
/// to the server and that the server reflects the appropriate number of clients

0 commit comments

Comments
 (0)