You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
fix: Use Time.unscaledDeltaTime instead of Time.deltaTime as time step (#2187)
* fix: Use Time.unscaledDeltaTime instead of Time.deltaTime as time step (#2171)
This fixes the case of Time.timeScale = 0 stopping the NetworkManager to update.
This as no influence on all projects that always have Time.timeScale = 1.
+ Add tests
+ Change existing test using Assert.Equal(boolExpr) to the correct Assert function to display real values expected instead of just "true" or "false"
* style: removing unrelated stylistic differences. Fixing brackets placement (netcode.standards)
* test: test adjustments
* test: test adjustments
* test: Applying PR review suggestion of saving the time scale
* test: Applying PR review suggestion of saving the time scale, second location
* Reverted changes to AddNetworkPrefabTests and fixed instabilities caused by NetworkManager.Singleton (can we get rid of that completely soon?)
* reverting unwanted whitespace change
* reducing the test cases to 0.0f, 1.0f and 2.0f timescales
* Revert "Reverted changes to AddNetworkPrefabTests and fixed instabilities caused by NetworkManager.Singleton (can we get rid of that completely soon?)"
This reverts commit 02a222e.
Co-authored-by: PitouGames <pitou.games@gmail.com>
Co-authored-by: Kitty Draper <kitty.draper@unity3d.com>
Copy file name to clipboardExpand all lines: com.unity.netcode.gameobjects/CHANGELOG.md
+1Lines changed: 1 addition & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -21,6 +21,7 @@ Additional documentation and release notes are available at [Multiplayer Documen
21
21
- Fixed ClientRpcs always reporting in the profiler view as going to all clients, even when limited to a subset of clients by `ClientRpcParams`. (#2144)
22
22
- Fixed RPC codegen failing to choose the correct extension methods for `FastBufferReader` and `FastBufferWriter` when the parameters were a generic type (i.e., List<int>) and extensions for multiple instantiations of that type have been defined (i.e., List<int> and List<string>) (#2142)
23
23
- Fixed throwing an exception in `OnNetworkUpdate` causing other `OnNetworkUpdate` calls to not be executed. (#1739)
24
+
- Fixed synchronisation when Time.timeScale is set to 0. This changes timing update to use unscaled deltatime. Now network updates rate are independant from the local time scale. (#2171)
@@ -70,7 +91,7 @@ public IEnumerator CorrectAmountTicksTest()
70
91
71
92
Assert.AreEqual(previous_localTickCalculated,NetworkManager.Singleton.LocalTime.Tick,$"Calculated local tick {previous_localTickCalculated} does not match local tick {NetworkManager.Singleton.LocalTime.Tick}!");
72
93
Assert.AreEqual(previous_serverTickCalculated,NetworkManager.Singleton.ServerTime.Tick,$"Calculated server tick {previous_serverTickCalculated} does not match server tick {NetworkManager.Singleton.ServerTime.Tick}!");
73
-
Assert.True(Mathf.Approximately((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}!");
94
+
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);
0 commit comments