Skip to content

Commit 4170dfe

Browse files
test
Adding debug information to better understand the failure.
1 parent d87bd75 commit 4170dfe

File tree

2 files changed

+16
-3
lines changed

2 files changed

+16
-3
lines changed

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

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -632,14 +632,27 @@ protected bool PositionsMatchesValue(Vector3 positionToMatch)
632632
var nonAuthorityPosition = m_NonAuthoritativeTransform.transform.position;
633633
var auhtorityIsEqual = Approximately(authorityPosition, positionToMatch);
634634
var nonauthorityIsEqual = Approximately(nonAuthorityPosition, positionToMatch);
635+
var authorityTimeAndTick = string.Empty;
636+
var nonAuthorityTimeAndTick = string.Empty;
637+
638+
if (m_AuthoritativeTransform.NetworkManager)
639+
{
640+
var authTime = m_AuthoritativeTransform.NetworkManager.LocalTime;
641+
authorityTimeAndTick = $"[{authTime.Time}[{authTime.Tick}]]";
642+
}
643+
if (m_NonAuthoritativeTransform.NetworkManager)
644+
{
645+
var nonAuthTime = m_NonAuthoritativeTransform.NetworkManager.LocalTime;
646+
nonAuthorityTimeAndTick = $"[{nonAuthTime.Time}[{nonAuthTime.Tick}]]";
647+
}
635648

636649
if (!auhtorityIsEqual)
637650
{
638-
VerboseDebug($"Authority position {authorityPosition} != position to match: {positionToMatch}!");
651+
VerboseDebug($"[{authorityTimeAndTick}] Authority position {authorityPosition} != position to match: {positionToMatch} [{nonAuthorityTimeAndTick}]!");
639652
}
640653
if (!nonauthorityIsEqual)
641654
{
642-
VerboseDebug($"NonAuthority position {nonAuthorityPosition} != position to match: {positionToMatch}!");
655+
VerboseDebug($"[{authorityTimeAndTick}] NonAuthority position {nonAuthorityPosition} != position to match: {positionToMatch} [{nonAuthorityTimeAndTick}]!");
643656
}
644657
return auhtorityIsEqual && nonauthorityIsEqual;
645658
}

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -289,7 +289,7 @@ public void NonAuthorityOwnerSettingStateTest([Values] Interpolation interpolati
289289
m_NonAuthoritativeTransform.RotAngleThreshold = m_AuthoritativeTransform.RotAngleThreshold = 0.1f;
290290

291291
m_EnableVerboseDebug = true;
292-
292+
VerboseDebug($"Target Frame Rate: {Application.targetFrameRate}");
293293
m_AuthoritativeTransform.Teleport(Vector3.zero, Quaternion.identity, Vector3.one);
294294
var success = WaitForConditionOrTimeOutWithTimeTravel(() => PositionRotationScaleMatches(Vector3.zero, Quaternion.identity.eulerAngles, Vector3.one), 800);
295295
Assert.True(success, $"Timed out waiting for initialization to be applied!");

0 commit comments

Comments
 (0)