Skip to content

Commit a5d9bf8

Browse files
Test
Seeing if this fixes the issue.
1 parent fc9ee50 commit a5d9bf8

File tree

1 file changed

+13
-18
lines changed

1 file changed

+13
-18
lines changed

com.unity.netcode.gameobjects/Tests/Runtime/NetworkTransform/NetworkTransformGeneral.cs

Lines changed: 13 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -21,14 +21,9 @@ public NetworkTransformGeneral(HostOrServer testWithHost, Authority authority, N
2121
protected override bool m_SetupIsACoroutine => false;
2222
protected override bool m_TearDownIsACoroutine => false;
2323

24-
protected override void OnInlineTearDown()
25-
{
26-
m_EnableVerboseDebug = false;
27-
base.OnInlineTearDown();
28-
}
29-
3024
protected override void OnOneTimeTearDown()
3125
{
26+
m_EnableVerboseDebug = false;
3227
NetworkTransform.AssignDefaultInterpolationType = false;
3328
NetworkTransform.DefaultInterpolationType = NetworkTransform.InterpolationTypes.Lerp;
3429
base.OnOneTimeTearDown();
@@ -286,45 +281,45 @@ public void TestMultipleExplicitSetStates([Values] Interpolation interpolation)
286281
[Test]
287282
public void NonAuthorityOwnerSettingStateTest([Values] Interpolation interpolation)
288283
{
289-
m_EnableVerboseDebug = true;
290284
var interpolate = interpolation == Interpolation.EnableInterpolate;
291285
m_AuthoritativeTransform.Interpolate = interpolate;
292286
m_NonAuthoritativeTransform.Interpolate = interpolate;
293287
m_NonAuthoritativeTransform.RotAngleThreshold = m_AuthoritativeTransform.RotAngleThreshold = 0.1f;
294-
// Give a little bit of time before sending things with this test
295-
for (int i = 0; i < 10; i++)
296-
{
297-
TimeTravelAdvanceTick();
298-
}
288+
289+
m_EnableVerboseDebug = true;
290+
291+
m_AuthoritativeTransform.Teleport(Vector3.zero, Quaternion.identity, Vector3.one);
292+
var success = WaitForConditionOrTimeOutWithTimeTravel(() => PositionRotationScaleMatches(Vector3.zero, Quaternion.identity.eulerAngles, Vector3.one), 800);
293+
Assert.True(success, $"Timed out waiting for initialization to be applied!");
299294

300295
// Test one parameter at a time first
301-
var newPosition = new Vector3(125f, 35f, 65f);
296+
var newPosition = new Vector3(55f, 35f, 65f);
302297
var newRotation = Quaternion.Euler(1, 2, 3);
303298
var newScale = new Vector3(2.0f, 2.0f, 2.0f);
304299
m_NonAuthoritativeTransform.SetState(newPosition, null, null, interpolate);
305-
var success = WaitForConditionOrTimeOutWithTimeTravel(() => PositionsMatchesValue(newPosition), 120);
300+
success = WaitForConditionOrTimeOutWithTimeTravel(() => PositionsMatchesValue(newPosition), 800);
306301
Assert.True(success, $"Timed out waiting for non-authoritative position state request to be applied!");
307302
Assert.True(Approximately(newPosition, m_AuthoritativeTransform.transform.position), "Authoritative position does not match!");
308303
Assert.True(Approximately(newPosition, m_NonAuthoritativeTransform.transform.position), "Non-Authoritative position does not match!");
309304
m_NonAuthoritativeTransform.SetState(null, newRotation, null, interpolate);
310-
success = WaitForConditionOrTimeOutWithTimeTravel(() => RotationMatchesValue(newRotation.eulerAngles));
305+
success = WaitForConditionOrTimeOutWithTimeTravel(() => RotationMatchesValue(newRotation.eulerAngles), 800);
311306
Assert.True(success, $"Timed out waiting for non-authoritative rotation state request to be applied!");
312307
Assert.True(Approximately(newRotation.eulerAngles, m_AuthoritativeTransform.transform.rotation.eulerAngles), "Authoritative rotation does not match!");
313308
Assert.True(Approximately(newRotation.eulerAngles, m_NonAuthoritativeTransform.transform.rotation.eulerAngles), "Non-Authoritative rotation does not match!");
314309

315310
m_NonAuthoritativeTransform.SetState(null, null, newScale, interpolate);
316-
success = WaitForConditionOrTimeOutWithTimeTravel(() => ScaleMatchesValue(newScale));
311+
success = WaitForConditionOrTimeOutWithTimeTravel(() => ScaleMatchesValue(newScale), 800);
317312
Assert.True(success, $"Timed out waiting for non-authoritative scale state request to be applied!");
318313
Assert.True(Approximately(newScale, m_AuthoritativeTransform.transform.localScale), "Authoritative scale does not match!");
319314
Assert.True(Approximately(newScale, m_NonAuthoritativeTransform.transform.localScale), "Non-Authoritative scale does not match!");
320315

321316
// Test all parameters at once
322-
newPosition = new Vector3(55f, 95f, -25f);
317+
newPosition = new Vector3(-10f, 95f, -25f);
323318
newRotation = Quaternion.Euler(20, 5, 322);
324319
newScale = new Vector3(0.5f, 0.5f, 0.5f);
325320

326321
m_NonAuthoritativeTransform.SetState(newPosition, newRotation, newScale, interpolate);
327-
success = WaitForConditionOrTimeOutWithTimeTravel(() => PositionRotationScaleMatches(newPosition, newRotation.eulerAngles, newScale), 120);
322+
success = WaitForConditionOrTimeOutWithTimeTravel(() => PositionRotationScaleMatches(newPosition, newRotation.eulerAngles, newScale), 800);
328323
Assert.True(success, $"Timed out waiting for non-authoritative position, rotation, and scale state request to be applied!");
329324
Assert.True(Approximately(newPosition, m_AuthoritativeTransform.transform.position), "Authoritative position does not match!");
330325
Assert.True(Approximately(newPosition, m_NonAuthoritativeTransform.transform.position), "Non-Authoritative position does not match!");

0 commit comments

Comments
 (0)