diff --git a/doc/classes/CallbackTweener.xml b/doc/classes/CallbackTweener.xml index 64b47183bee6..e6a37a20e12b 100644 --- a/doc/classes/CallbackTweener.xml +++ b/doc/classes/CallbackTweener.xml @@ -5,6 +5,7 @@ [CallbackTweener] is used to call a method in a tweening sequence. See [method Tween.tween_callback] for more usage information. + The tweener will finish automatically if the callback's target object is freed. [b]Note:[/b] [method Tween.tween_callback] is the only correct way to create [CallbackTweener]. Any [CallbackTweener] created manually will not function correctly. diff --git a/doc/classes/MethodTweener.xml b/doc/classes/MethodTweener.xml index c6e2bb676775..6f606763a1c8 100644 --- a/doc/classes/MethodTweener.xml +++ b/doc/classes/MethodTweener.xml @@ -5,6 +5,7 @@ [MethodTweener] is similar to a combination of [CallbackTweener] and [PropertyTweener]. It calls a method providing an interpolated value as a parameter. See [method Tween.tween_method] for more usage information. + The tweener will finish automatically if the callback's target object is freed. [b]Note:[/b] [method Tween.tween_method] is the only correct way to create [MethodTweener]. Any [MethodTweener] created manually will not function correctly. diff --git a/scene/animation/tween.cpp b/scene/animation/tween.cpp index bf0189840232..1b8c4101012d 100644 --- a/scene/animation/tween.cpp +++ b/scene/animation/tween.cpp @@ -675,6 +675,10 @@ bool CallbackTweener::step(double &r_delta) { return false; } + if (!callback.get_object()) { + return false; + } + elapsed_time += r_delta; if (elapsed_time >= delay) { Variant result; @@ -736,6 +740,10 @@ bool MethodTweener::step(double &r_delta) { return false; } + if (!callback.get_object()) { + return false; + } + elapsed_time += r_delta; if (elapsed_time < delay) {