From bfbcfdce4f9c2edfcbcf71b24e55445ac0910ef1 Mon Sep 17 00:00:00 2001 From: Syntriax Date: Sat, 12 Apr 2025 17:49:30 +0300 Subject: [PATCH] fix: ticker behaviour working unexpectedly on instances where time increment is bigger than the period --- Engine.Systems/Time/TickerBehaviour.cs | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/Engine.Systems/Time/TickerBehaviour.cs b/Engine.Systems/Time/TickerBehaviour.cs index c20acb7..6f928e4 100644 --- a/Engine.Systems/Time/TickerBehaviour.cs +++ b/Engine.Systems/Time/TickerBehaviour.cs @@ -20,12 +20,12 @@ public class TickerBehaviour : StopwatchBehaviour, ITicker { base.OnUpdate(); - if (Time < nextTick) - return; - - nextTick += Period; - TickCounter++; - OnTick?.Invoke(this); + while (Time > nextTick) + { + nextTick += Period; + TickCounter++; + OnTick?.Invoke(this); + } } protected override void OnFinalize()