File tree Expand file tree Collapse file tree 2 files changed +6
-12
lines changed
com.unity.netcode.gameobjects/Tests/Runtime Expand file tree Collapse file tree 2 files changed +6
-12
lines changed Original file line number Diff line number Diff line change @@ -118,7 +118,7 @@ private bool ResetAllStates()
118118 else
119119 {
120120 var attachable = networkManager . SpawnManager . SpawnedObjects [ currentAttachableRoot . NetworkObjectId ] . GetComponentInChildren < TestAttachable > ( ) ;
121- attachable . ResetStates ( ) ;
121+ attachable ? . ResetStates ( ) ;
122122 }
123123
124124 // Target
@@ -129,7 +129,7 @@ private bool ResetAllStates()
129129 else
130130 {
131131 var node = networkManager . SpawnManager . SpawnedObjects [ m_TargetInstance . NetworkObjectId ] . GetComponentInChildren < TestNode > ( ) ;
132- node . ResetStates ( ) ;
132+ node ? . ResetStates ( ) ;
133133 }
134134
135135 // Target B
@@ -140,7 +140,7 @@ private bool ResetAllStates()
140140 else
141141 {
142142 var node = networkManager . SpawnManager . SpawnedObjects [ m_TargetInstanceB . NetworkObjectId ] . GetComponentInChildren < TestNode > ( ) ;
143- node . ResetStates ( ) ;
143+ node ? . ResetStates ( ) ;
144144 }
145145 }
146146 return m_ErrorLog . Length == 0 ;
Original file line number Diff line number Diff line change @@ -110,16 +110,10 @@ public IEnumerator OwnerPermissionTest()
110110 {
111111 ownerManager = m_ClientNetworkManagers [ objectIndex - 1 ] ;
112112 }
113- SpawnObject ( m_PrefabToSpawn , ownerManager ) ;
113+ var spawnedInstance = SpawnObject ( m_PrefabToSpawn , ownerManager ) ;
114114
115- // wait for each object to spawn on each client
116- for ( var clientIndex = 0 ; clientIndex < 3 ; clientIndex ++ )
117- {
118- while ( OwnerPermissionObject . Objects [ objectIndex , clientIndex ] == null )
119- {
120- yield return new WaitForSeconds ( 0.0f ) ;
121- }
122- }
115+ yield return WaitForSpawnedOnAllOrTimeOut ( spawnedInstance ) ;
116+ AssertOnTimeout ( $ "Timed out waiting for all clients to spawn { spawnedInstance . name } !") ;
123117 }
124118
125119 var nextValueToWrite = 1 ;
You can’t perform that action at this time.
0 commit comments