If you create a Tween and then try to play it backwards it doesn't work
C#
DOTween.defaultAutoKill = false;
_openLevelPanel = levelPanel.transform.DOLocalRotate(new Vector3(0, 180, 0), 1).From().Pause();
_openLevelPanel.Complete(); // This works sending the tween to the end instantly
_openLevelPanel.PlayBackwards(); // This doesn't works
DOTween v.1.0.770
Unity v 5.0.0f4
Hi,
Sorry for being late, I erroneously thought I had already answered you. Your tween doesn't play backwards because, by default, it's killed as soon as it completes. Add a SetAutoKill(false) to it if you want to reuse it (like playing it backwards after completion).
Cheers,
Daniele
I am using the newest version of DOTween and I am running into the same issue. I do not understand why this Issue got closed as the original code example actually states that autoKill is off. DOTween.defaultAutoKill = false;
I tried to use a simple fade tween and call PlayForward(), a bit later call PlayBackward(), then PlayForward() again. The issue is, if the first forward has completed, calling
PlayBackward();
PlayForward();
starts the tween from the beginning. I would expect it to stay at the end, because PlayBackward() never could run to the beginning:
sequence.PlayForward();
// let it complete
sequence.PlayBackward();
sequence.PlayForward(); // Note: no delay after calling backward
// tween starts from the beginning <-- unexpected
Ouch you're right. It's a different problem from the one @SharpEdgeMarshall had though (Fabio I didn't notice you had set AutoKill to false, but I can't replicate your issue so if you're still encountering it tell me more).
@Metallix, in your case it's because you're calling PlayForward the same frame of a PlayBackwards, immediately after, on an already completed tween. That's indeed a bug and this update (1.2.251) should fix it, can you check it out and let me know if everything's alright on your side too?
Most helpful comment
Hi,
Sorry for being late, I erroneously thought I had already answered you. Your tween doesn't play backwards because, by default, it's killed as soon as it completes. Add a SetAutoKill(false) to it if you want to reuse it (like playing it backwards after completion).
Cheers,
Daniele