diff options
Diffstat (limited to 'scene/animation')
-rw-r--r-- | scene/animation/tween.cpp | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/scene/animation/tween.cpp b/scene/animation/tween.cpp index 53ff3eeeae..a2fed718be 100644 --- a/scene/animation/tween.cpp +++ b/scene/animation/tween.cpp @@ -283,6 +283,10 @@ bool Tween::step(float p_delta) { float step_delta = rem_delta; step_active = false; +#ifdef DEBUG_ENABLED + float prev_delta = rem_delta; +#endif + for (Ref<Tweener> &tweener : tweeners.write[current_step]) { // Modified inside Tweener.step(). float temp_delta = rem_delta; @@ -312,6 +316,12 @@ bool Tween::step(float p_delta) { start_tweeners(); } } + +#ifdef DEBUG_ENABLED + if (Math::is_equal_approx(rem_delta, prev_delta) && running && loops <= 0) { + ERR_FAIL_V_MSG(false, "Infinite loop detected. Check set_loops() description for more info."); + } +#endif } return true; |