com.unity.netcode.gameobjects@1.0.0-pre.5
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/) and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). Additional documentation and release notes are available at [Multiplayer Documentation](https://docs-multiplayer.unity3d.com). ## [1.0.0-pre.5] - 2022-01-26 ### Added - Added `PreviousValue` in `NetworkListEvent`, when `Value` has changed (#1528) ### Changed - NetworkManager's GameObject is no longer allowed to be nested under one or more GameObject(s).(#1484) - NetworkManager DontDestroy property was removed and now NetworkManager always is migrated into the DontDestroyOnLoad scene. (#1484) ### Fixed - Fixed network tick value sometimes being duplicated or skipped. (#1614) - Fixed The ClientNetworkTransform sample script to allow for owner changes at runtime. (#1606)
This commit is contained in:
@@ -198,6 +198,39 @@ namespace Unity.Netcode.EditorTests
|
||||
Assert.IsTrue(Approximately(startTime.Time, (startTime2 - dif).Time, maxAcceptableTotalOffset));
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void NetworkTickAdvanceTest()
|
||||
{
|
||||
var shortSteps = Enumerable.Repeat(1 / 30f, 1000);
|
||||
NetworkTickAdvanceTestInternal(shortSteps, 30, 0.0f, 0.0f);
|
||||
}
|
||||
|
||||
private NetworkTickSystem m_TickSystem;
|
||||
private NetworkTimeSystem m_TimeSystem;
|
||||
private int m_PreviousTick;
|
||||
|
||||
private void NetworkTickAdvanceTestInternal(IEnumerable<float> steps, uint tickRate, float start, float start2 = 0f)
|
||||
{
|
||||
m_PreviousTick = 0;
|
||||
m_TickSystem = new NetworkTickSystem(tickRate, start, start2);
|
||||
m_TimeSystem = NetworkTimeSystem.ServerTimeSystem();
|
||||
|
||||
m_TickSystem.Tick += TickUpdate;
|
||||
foreach (var step in steps)
|
||||
{
|
||||
m_TimeSystem.Advance(step);
|
||||
m_TickSystem.UpdateTick(m_TimeSystem.LocalTime, m_TimeSystem.ServerTime);
|
||||
}
|
||||
}
|
||||
|
||||
private void TickUpdate()
|
||||
{
|
||||
// Make sure our tick is precisely 1 + m_PreviousTick
|
||||
Assert.IsTrue(m_TickSystem.LocalTime.Tick == m_PreviousTick + 1);
|
||||
// Assign the m_PreviousTick value for next tick check
|
||||
m_PreviousTick = m_TickSystem.LocalTime.Tick;
|
||||
}
|
||||
|
||||
private static bool Approximately(double a, double b, double epsilon = 0.000001d)
|
||||
{
|
||||
var dif = Math.Abs(a - b);
|
||||
|
||||
Reference in New Issue
Block a user