From 0c213fbce4be9ebe49009ebc3dbd637318665ac0 Mon Sep 17 00:00:00 2001 From: mischa Date: Sat, 27 Jul 2024 10:03:20 +0200 Subject: [PATCH] NetworkClient/Server Broadcast: make this easier to read --- Assets/Mirror/Core/NetworkClient.cs | 4 ++-- Assets/Mirror/Core/NetworkServer.cs | 3 ++- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/Assets/Mirror/Core/NetworkClient.cs b/Assets/Mirror/Core/NetworkClient.cs index c8f01205c..f9597ed1b 100644 --- a/Assets/Mirror/Core/NetworkClient.cs +++ b/Assets/Mirror/Core/NetworkClient.cs @@ -1598,8 +1598,8 @@ internal static void NetworkLateUpdate() // snapshots _but_ not every single tick. // // Unity 2019 doesn't have Time.timeAsDouble yet - if (!Application.isPlaying || - AccurateInterval.Elapsed(NetworkTime.localTime, sendInterval, ref lastSendTime)) + bool sendIntervalElapsed = AccurateInterval.Elapsed(NetworkTime.localTime, sendInterval, ref lastSendTime); + if (!Application.isPlaying || sendIntervalElapsed) { Broadcast(); } diff --git a/Assets/Mirror/Core/NetworkServer.cs b/Assets/Mirror/Core/NetworkServer.cs index 45d05aad9..845542285 100644 --- a/Assets/Mirror/Core/NetworkServer.cs +++ b/Assets/Mirror/Core/NetworkServer.cs @@ -2034,7 +2034,8 @@ internal static void NetworkLateUpdate() // NetworkTransform, so they can sync on same interval as time // snapshots _but_ not every single tick. // Unity 2019 doesn't have Time.timeAsDouble yet - if (!Application.isPlaying || AccurateInterval.Elapsed(NetworkTime.localTime, sendInterval, ref lastSendTime)) + bool sendIntervalElapsed = AccurateInterval.Elapsed(NetworkTime.localTime, sendInterval, ref lastSendTime); + if (!Application.isPlaying || sendIntervalElapsed) Broadcast(); }