Dotween: Empty Sequence bug

Created on 30 Jul 2015  Ā·  18Comments  Ā·  Source: Demigiant/dotween

Empty child sequences will mess up the parent sequence.

DOTween.Sequence()
.AppendCallback(() => Debug.Log("Doesn't run"))
.Append(DOTween.Sequence())
.AppendCallback(() => Debug.Log("OK"));

In complex tweens this can cause unexpected behaviour that is hard to track down.

DOTween v1.0.750

data needed resolved

Most helpful comment

This isn’t a big issue but it might save someone else some time figuring it out if they have a similar problem. Since tweens are often used to build dynamic animations, you could accidentally run into a situation like this, if you are not aware of the issue. For example:

Sequence subSequence = DOTween.Sequence();
foreach (Transform t in someCollection)
    subSequence.Append(t.DOMove(…));
mainSequence.Append(subSequence);

This is dangerous if there is a chance that ā€someCollectionā€ would to be empty at some point in the game.

All 18 comments

Never thought someone would use an empty child Sequence. Why would you do that :O
That is indeed not supported, and I would prefer not to support it (because a simple "is this Sequence empty" check wouldn't work, so I would have to add more checks for each Append/Insert/etc for a use case for which I don't see the usefulness).

This isn’t a big issue but it might save someone else some time figuring it out if they have a similar problem. Since tweens are often used to build dynamic animations, you could accidentally run into a situation like this, if you are not aware of the issue. For example:

Sequence subSequence = DOTween.Sequence();
foreach (Transform t in someCollection)
    subSequence.Append(t.DOMove(…));
mainSequence.Append(subSequence);

This is dangerous if there is a chance that ā€someCollectionā€ would to be empty at some point in the game.

I just had the above scenario happen to me and it took me quite a while to figure out what the problem was.

i too want to be able to play an empty sequence (because configuration could allow for that).

DOTween.Sequence().AppendInterval(1f).AppendCallback(() => Debug.Log("done"));

callback will never be reached :(

Ahoy. In the latest version (1.1.695) callbacks-only Sequences should work (as long as they have a duration bigger than 0). Did you try it with that?

i was on 1.1.640. will try, thank you.

the >0 duration may still be an issue though. i think it's counter-intuitive for the system to just silently swallow the callbacks.

Just wanted to say this issue is horrible. We have a complex system that dynamically creates sequences, and things completely broke in a very specific (but extremely hard to track) flow.
The worst thing about it that it silently fails - no exception or warning, execution simply stops.
Seeing this issue has been open since 2015 is even more disheartening.
This _has_ to be addressed one way or another, please don't disregard it as "why would someone do that", because with a library as successful as DOtween someone, somewhere, will.

Ahoy,
You're right, I did dismiss it as "not supported", but left the issue open to come back to it one day. I now added it to my Trello list as the next feature to work on (this and more warnings) :) As soon as I complete and release the big update I'm working on now (a modular system, which is working since a while but the upgrade process is driving me kind of crazy) I will jump on this.

Sounds great, thanks for your time and effort!
Sorry if I came across too aggressive earlier, it was after an intense "WTF is going on" bug hunting session that led us to this issue :)

No worries I understand :)

Little update. I have finished the big update (it was a bloodbath) and if everything goes well I'll prep it for the Asset Store today. Then I can start working on this fix and another feature (might get on it already during the weekend, but probably next week).

Weā€˜re so excited! :) Glad you found the time.

On a side note: As a DOTween-poweruser iā€˜m really interested in what changes with the modules and what drove you to refactor?

:)

The modules will allow to disable parts of DOTween that are related to Unity's own modules (the ones managed with the new Package Manager). This way, if you for example disable Physics/Physics2D/UI/Sprites/Audio) inside Unity, you can also disable the Physics/etc modules from DOTween. Seemed like a nice thing to have (especially when you're developing for WebGL or mobile).

Plus for DOTween Pro users, the extra shortcuts for external assets like TextMesh Pro will be enabled/disabled manually (so I won't have to deal anymore with Unity finding new ways to break my auto-detection systems :D).

Finally, modules will be separate loose scripts, so no more extra assemblies depending on Unity's version (like DOTween43/46/50). Much leaner :P

Ah so no more setup? It was sometimes a real pain with dotween not setup and scripts relying on it, thus no successful compilation thus no setup possible. Hope thatā€˜s a thing of the past too then.

Ok no more thread hijacking :) Thanks for all your work!

Ah setup will still be required indeed, to enable/disable modules, and then to re-enable/disable them automatically after an upgrade. Though DOTween being a DLL it should work even if there's script compilation errors (unless they're inside DOTween), so Setup should always be possible. I'm worried that sometimes it wasn't possible for you :O

Ahoy!

I'm working on this issue right now, trying to reproduce it in all possible ways.

CASE A: the bug happens only with OnComplete/OnStepComplete and only for nested 0-duration Sequences inside parent 0-duration Sequences.
Adding an empty Sequence (A) that ALSO has 0 duration inside another Sequence (B) that ALSO has 0 duration: in those cases, all callbacks will still work (including ones added via Insert/AppendCallback) except A's OnComplete and OnStepComplete

CASE B: this also happens if you nest a Tween with a missing target inside another Sequence (though it's not really related to this issue)

If you have other ways to reproduce this please let me know :P

Aaaand it should be done (at least for CASE A and CASE B above, since I found no other way to reproduce it) :) Can you test this new version (v1.2.070) out and let me know?

Other than fixing bugs, this new version will NOT auto-kill Sequences anymore if a nested tween fails (because its target is NULL or something like that). Instead the tween will simply be killed separately and the Sequence will move on without it.

P.S. This version also fixes this issue.
P.P.S. Please note that this update also includes the Modules upgrade, so follow these instructions carefully when upgrading because it's a major one (and if you're using DOTween Pro instead let me know and don't test this, because you'll first need the Pro upgrade).

@Demigiant
This problem still seems to exist if "Kill Whole Sequence" mode is selected.
Is an inside tween considered as a failure when it is an empty sequence?

Was this page helpful?
0 / 5 - 0 ratings

Related issues

ShadowTM picture ShadowTM  Ā·  4Comments

Wolar picture Wolar  Ā·  5Comments

wilczarzgit picture wilczarzgit  Ā·  9Comments

SharpEdgeMarshall picture SharpEdgeMarshall  Ā·  3Comments

jizc picture jizc  Ā·  10Comments