Skip to content

Commit c62c10f

Browse files
test
Some more instability related fixes.
1 parent a3db8b2 commit c62c10f

File tree

2 files changed

+6
-12
lines changed

2 files changed

+6
-12
lines changed

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff 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;

com.unity.netcode.gameobjects/Tests/Runtime/NetworkVariable/OwnerPermissionTests.cs

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff 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;

0 commit comments

Comments
 (0)