From 70abf06a08bb775d32241f2bd492616117cdd568 Mon Sep 17 00:00:00 2001 From: James Frowen Date: Sun, 28 Apr 2024 18:45:58 +0100 Subject: [PATCH] test: fixing tests to use to use just using Time.time sometimes causes rounding errors where it will not sync right away. Using timeAsDouble as the internal code does solves this --- Assets/Tests/Runtime/Syncing/SyncDirectionSyncVarsTest_Host.cs | 2 +- Assets/Tests/Runtime/Syncing/SyncDirectionTestBase.cs | 2 +- Assets/Tests/Runtime/Syncing/SyncVarVirtualTest.cs | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Assets/Tests/Runtime/Syncing/SyncDirectionSyncVarsTest_Host.cs b/Assets/Tests/Runtime/Syncing/SyncDirectionSyncVarsTest_Host.cs index 35aad69aaf6..b7035a92f21 100644 --- a/Assets/Tests/Runtime/Syncing/SyncDirectionSyncVarsTest_Host.cs +++ b/Assets/Tests/Runtime/Syncing/SyncDirectionSyncVarsTest_Host.cs @@ -68,7 +68,7 @@ protected static void SetDirection(NetworkBehaviour behaviour, SyncFrom from, Sy behaviour.SyncSettings.From = from; behaviour.SyncSettings.To = to; - behaviour._nextSyncTime = Time.time; + behaviour._nextSyncTime = Time.timeAsDouble; behaviour.UpdateSyncObjectShouldSync(); } protected void SetDirection(SyncFrom from, SyncTo to) diff --git a/Assets/Tests/Runtime/Syncing/SyncDirectionTestBase.cs b/Assets/Tests/Runtime/Syncing/SyncDirectionTestBase.cs index 33b8c9c49c5..9e2cf15876b 100644 --- a/Assets/Tests/Runtime/Syncing/SyncDirectionTestBase.cs +++ b/Assets/Tests/Runtime/Syncing/SyncDirectionTestBase.cs @@ -53,7 +53,7 @@ protected static void SetDirection(NetworkBehaviour behaviour, SyncFrom from, Sy behaviour.SyncSettings.From = from; behaviour.SyncSettings.To = to; - behaviour._nextSyncTime = Time.time; + behaviour._nextSyncTime = Time.timeAsDouble; behaviour.SyncSettings.Timing = SyncTiming.NoInterval; behaviour.UpdateSyncObjectShouldSync(); } diff --git a/Assets/Tests/Runtime/Syncing/SyncVarVirtualTest.cs b/Assets/Tests/Runtime/Syncing/SyncVarVirtualTest.cs index 0a5c201b54d..845366ed2b8 100644 --- a/Assets/Tests/Runtime/Syncing/SyncVarVirtualTest.cs +++ b/Assets/Tests/Runtime/Syncing/SyncVarVirtualTest.cs @@ -79,7 +79,7 @@ private void SyncValuesWithClient() observersWriter.Reset(); // make sure it is time to sync - serverComponent._nextSyncTime = Time.time; + serverComponent._nextSyncTime = Time.timeAsDouble; serverIdentity.OnSerializeAll(true, ownerWriter, observersWriter); // apply all the data from the server object