Demigiant / dotween

A Unity C# animation engine. HOTween v2
http://dotween.demigiant.com
Other
2.33k stars 348 forks source link

Pause behavior feels inconsistent #573

Closed Garfounkel closed 2 years ago

Garfounkel commented 2 years ago

When pausing an infinite looped sequence with _seq.Pause() I expected a later call to _seq.Play() to resume the tween from where it left off. However, it starts from the current state like if it was a new tween but without actual context from the earlier pause.

Maybe an example will be more clear: let's say I tween the position from (0, 0) to (1, 1) and back infinitely. Then I pause the tween when it happens to be around (0.9, 0.9). Then I later resume the tween with _seq.Play(). At this point the object is positioned at (0.9, 0.9) but the tween starts like if it was new. Its target is (1, 1), but its starting position is now (0.9, 0.9), therefor it now goes back and forth between (0.9, 0.9) and (1, 1) instead of (0, 0) to (1, 1) like I expected (since I wanted to resume the paused tween). If this is the expected behavior, then it feels like Pause should really be called Stop. Am I missing something?

Note that I'm calling _seq.Pause() and _seq.Play() respectively in OnDisable() and OnEnable() if that changes anything.

Demigiant commented 2 years ago

Ahoy!

That is definitely not the expected behaviour, and considering how DOTween works I'd say it's impossible for it to start looping between different values unless you recreated that Sequence, which I think is the problem somewhere. Could you add a log when you create it, to check that out? You're probably recreating it somewhere.

Cheers, Daniele

Demigiant commented 2 years ago

P.S. Marking this invalid because I'm sure the pause is not the issue, but let me know.

Garfounkel commented 2 years ago

Never mind, you were correct. I completely missed the fact that I was recreating the Sequence on each call to OnEnable. My bad, thanks for your prompt answer!

And thanks for making DoTween, it's a great library.

Demigiant commented 2 years ago

Great, glad you solved it :)