@@ -83,25 +83,6 @@ public static void ClientNetworkVariableTestSpawned(NetworkVariableTest networkV
83
83
s_ClientNetworkVariableTestInstances . Add ( networkVariableTest ) ;
84
84
}
85
85
86
- private const float k_TimeOutWaitPeriod = 2.0f ;
87
- private static float s_TimeOutPeriod ;
88
-
89
- /// <summary>
90
- /// This will simply advance the timeout period
91
- /// </summary>
92
- private static void AdvanceTimeOutPeriod ( )
93
- {
94
- s_TimeOutPeriod = Time . realtimeSinceStartup + k_TimeOutWaitPeriod ;
95
- }
96
-
97
- /// <summary>
98
- /// Checks if the timeout period has elapsed
99
- /// </summary>
100
- private static bool HasTimedOut ( )
101
- {
102
- return s_TimeOutPeriod <= Time . realtimeSinceStartup ;
103
- }
104
-
105
86
// Player1 component on the server
106
87
private NetworkVariableTest m_Player1OnServer ;
107
88
@@ -180,12 +161,13 @@ private IEnumerator InitializeServerAndClients(bool useHost)
180
161
var allClientNetworkVariableTestInstancesSpawned = false ;
181
162
var waitPeriod = 1.0f / m_ServerNetworkManager . NetworkConfig . TickRate ;
182
163
var timedOut = false ;
183
- AdvanceTimeOutPeriod ( ) ;
184
- while ( ! allClientNetworkVariableTestInstancesSpawned && ! HasTimedOut ( ) )
164
+ var timeOutPeriod = Time . realtimeSinceStartup + 2.0f ;
165
+
166
+ while ( ! allClientNetworkVariableTestInstancesSpawned && ! timedOut )
185
167
{
186
168
allClientNetworkVariableTestInstancesSpawned = s_ClientNetworkVariableTestInstances . Count >= NbClients ;
187
- timedOut = HasTimedOut ( ) ;
188
169
yield return new WaitForSeconds ( waitPeriod ) ;
170
+ timedOut = timeOutPeriod < Time . realtimeSinceStartup ;
189
171
}
190
172
191
173
Assert . False ( timedOut , "Timed out waiting for all client NetworkVariableTest instances to register they have spawned!" ) ;
0 commit comments