godot
godot copied to clipboard
Unexpected set_parallel behavior in SceneTreeTween
Godot version
3.5.1.stable.mono
System information
Windows 11
Issue description
The set_parallel function of SceneTreeTween explicitly states that "Tweeners appended after this method will by default run simultaneously, as opposed to sequentially."
However, this is not the case. A tween defined before the call to set_parallel appears not to run at all. Or perhaps the tween defined after set_parallel is being run prematurely thus overriding it.
# Root node is a ColorRect
var tween = create_tween()
tween.tween_property(self, "color", Color.black, 1)
tween.tween_property(self, "color", Color.white, 1)
tween.set_parallel()
tween.tween_property(self, "color", Color.red, 1)
In the above snippet, I expect the following to happen:
- Tween the
ColorRectto black over 1 second. - Tween the
ColorRectto white over 1 second. - Enable parallel execution
- Tween the
ColorRectto red over 1 second.
However, the observed behavior is instead as follows:
- The
ColorRectis tweened to black over 1 second. - The
ColorRectis tweened to red over 1 second.
In the observed behavior, the transition back to white never happens. The tween goes immediately from black to red, despite the fact that a tween to white is specified before set_parallel is called.
Steps to reproduce
See issue description or minimal reproduction project.
Minimal reproduction project
set_parallel() has the same immediate effect as parallel(), i.e. the next Tweener will run in parallel to the previously defined one. In your case white and red animations happen at the same time and red is overwriting the color, because it's animated later.
Maybe the description needs some clarification.
Yeah that doesn't make sense given the description. The description of set_parallel only mentions tweens set after the call. Arguably it should not have any immediate effect. Otherwise every tween defined immediately prior to the call will be parallelized which, I would guess, would be undesired in almost every case. At the very least it's not intuitive.