Skip to content

Commit 0346cc4

Browse files
Revert "Test"
This reverts commit 1c9cb05.
1 parent 1c9cb05 commit 0346cc4

File tree

1 file changed

+10
-9
lines changed

1 file changed

+10
-9
lines changed

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

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -62,34 +62,35 @@ public IEnumerator PlayerLoopTimeTest_WithDifferentTimeScale([Values(0.0f, 0.1f,
6262
public IEnumerator CorrectAmountTicksTest()
6363
{
6464
NetworkTickSystem tickSystem = NetworkManager.Singleton.NetworkTickSystem;
65-
double delta = tickSystem.LocalTime.FixedDeltaTimeAsDouble;
65+
float delta = tickSystem.LocalTime.FixedDeltaTime;
6666
int previous_localTickCalculated = 0;
6767
int previous_serverTickCalculated = 0;
6868

6969
while (tickSystem.LocalTime.Time < 3f)
7070
{
7171
yield return null;
7272

73-
var localTickCalculated = tickSystem.LocalTime.Time / delta;
74-
previous_localTickCalculated = (int)localTickCalculated;
73+
var tickCalculated = tickSystem.LocalTime.Time / delta;
74+
previous_localTickCalculated = (int)tickCalculated;
7575

7676
// This check is needed due to double division imprecision of large numbers
77-
if ((localTickCalculated - previous_localTickCalculated) >= 0.999999999999)
77+
if ((tickCalculated - previous_localTickCalculated) >= 0.999999999999)
7878
{
7979
previous_localTickCalculated++;
8080
}
8181

82-
var serverTickCalculated = tickSystem.ServerTime.Time / delta;
83-
previous_serverTickCalculated = (int)serverTickCalculated;
82+
83+
tickCalculated = NetworkManager.Singleton.ServerTime.Time / delta;
84+
previous_serverTickCalculated = (int)tickCalculated;
8485

8586
// This check is needed due to double division imprecision of large numbers
86-
if ((serverTickCalculated - previous_serverTickCalculated) >= 0.999999999999)
87+
if ((tickCalculated - previous_serverTickCalculated) >= 0.999999999999)
8788
{
8889
previous_serverTickCalculated++;
8990
}
9091

91-
Assert.AreEqual(previous_localTickCalculated, NetworkManager.Singleton.LocalTime.Tick, $"Calculated local tick {previous_localTickCalculated} does not match local tick {NetworkManager.Singleton.LocalTime.Tick}!]n Local Tick-Calc: {localTickCalculated} LocalTime: {tickSystem.LocalTime.Time} | Server Tick-Calc: {serverTickCalculated} ServerTime: {tickSystem.ServerTime.Time} | TickDelta: {delta}");
92-
Assert.AreEqual(previous_serverTickCalculated, NetworkManager.Singleton.ServerTime.Tick, $"Calculated server tick {previous_serverTickCalculated} does not match server tick {NetworkManager.Singleton.ServerTime.Tick}!\n Local Tick-Calc: {localTickCalculated} LocalTime: {tickSystem.LocalTime.Time} | Server Tick-Calc: {serverTickCalculated} ServerTime: {tickSystem.ServerTime.Time} | TickDelta: {delta}");
92+
Assert.AreEqual(previous_localTickCalculated, NetworkManager.Singleton.LocalTime.Tick, $"Calculated local tick {previous_localTickCalculated} does not match local tick {NetworkManager.Singleton.LocalTime.Tick}!");
93+
Assert.AreEqual(previous_serverTickCalculated, NetworkManager.Singleton.ServerTime.Tick, $"Calculated server tick {previous_serverTickCalculated} does not match server tick {NetworkManager.Singleton.ServerTime.Tick}!");
9394
Assert.AreEqual((float)NetworkManager.Singleton.LocalTime.Time, (float)NetworkManager.Singleton.ServerTime.Time, $"Local time {(float)NetworkManager.Singleton.LocalTime.Time} is not approximately server time {(float)NetworkManager.Singleton.ServerTime.Time}!", FloatComparer.s_ComparerWithDefaultTolerance);
9495
}
9596
}

0 commit comments

Comments
 (0)