Skip to content

Commit 5c0cc93

Browse files
committed
test: Applying PR review suggestion of saving the time scale, second location
1 parent 7c7bb53 commit 5c0cc93

2 files changed

Lines changed: 5 additions & 3 deletions

File tree

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

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -551,8 +551,6 @@ public IEnumerator NetworkVariableSync_WithDifferentTimeScale([Values(true, fals
551551
// Now wait for the client side version to be updated to k_TestVal1
552552
yield return WaitForConditionOrTimeOut(() => m_Player1OnClient1.TheScalar.Value == k_TestVal1);
553553
Assert.IsFalse(s_GlobalTimeoutHelper.TimedOut, "Timed out waiting for client-side NetworkVariable to update!");
554-
555-
Time.timeScale = 1.0f;
556554
}
557555

558556
[UnityTest]

com.unity.netcode.gameobjects/Tests/Runtime/Timing/NetworkTimeSystemTests.cs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,13 @@ public class NetworkTimeSystemTests
1515
private MonoBehaviourTest<PlayerLoopFixedTimeTestComponent> m_PlayerLoopFixedTimeTestComponent; // cache for teardown
1616
private MonoBehaviourTest<PlayerLoopTimeTestComponent> m_PlayerLoopTimeTestComponent; // cache for teardown
1717

18+
private float m_OriginalTimeScale = 1.0f;
19+
1820
[SetUp]
1921
public void Setup()
2022
{
23+
m_OriginalTimeScale = Time.timeScale;
24+
2125
// Create, instantiate, and host
2226
Assert.IsTrue(NetworkManagerHelper.StartNetworkManager(out _));
2327
}
@@ -97,7 +101,7 @@ public void TearDown()
97101
// Stop, shutdown, and destroy
98102
NetworkManagerHelper.ShutdownNetworkManager();
99103

100-
Time.timeScale = 1.0f;
104+
Time.timeScale = m_OriginalTimeScale;
101105

102106
if (m_PlayerLoopFixedTimeTestComponent != null)
103107
{

0 commit comments

Comments
 (0)