-
Notifications
You must be signed in to change notification settings - Fork 347
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Cannot play tween backwards #28
Comments
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, |
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.
|
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? |
Thank you so much! |
Hello! I have this setup: public class TransformAnomaly: IObjectAnomaly {
private Sequence _transformSequence;
public void Activate() {
Transform objectTransform = <...>;
_transformSequence = DOTween.Sequence().SetAutoKill(false);
// One of the ifs is true in this case, I checked in the debugger
// If ...
_transformSequence.Join(objectTransform.DOMove(newPosition, speed[0]));
// If ...
_transformSequence.Join(objectTransform.DORotate(newRotation, speed[1]));
// If ...
_transformSequence.Join(objectTransform.DOScale(newScale, speed[2]));
// Sequence above works, I see the effect on the GameObject
}
public void Deactivate() {
// At this point I can see in the debugger that Sequence is there with active = true, autoKill = false and isComplete = true
_transformSequence.PlayBackwards();
// PROBLEM HERE: the line above doesn't work. No errors, no effect.
}
} Am I doing something wrong? |
Ahoy! I don't see anything wrong in your code, but what would help is if you set DOTween's log mode to Verbose (in DOTween Utility Panel > Preferences). That way if you call a method and it fails it will tell you why. Let me know! |
In Unity window went to Tools > Demigiant > DOTween Utility Panel Launched play mode to cause behaviour Can it be recycling setting set to off? Was I supposed to turn it on at some point? (Sorry, it's literally my first time working with DOTween) UPD: Nope, tried switching recycling option on in DOTween Utility Panel, same issue, same console message (except "recycling: ON" now) |
I'm honestly very puzzled. I'm pretty sure that PlayBackwards has no bugs (also because I use it a lot), so there must be something I don't see that's happening (and no, recycling can't be the culprit: it's actually better off because DOTween recycles already by default and doesn't really need an extra layer). Could you add an OnKill callback and an OnUpdate to your Sequence, to see if something else is killing it and if the update call is running (see the 2 rows I added after your initial Sequence creation line)?
|
Added OnKill() and OnUpdate() exactly as you suggested. On Activate() it posts "I am updating for real" in the console once. |
I am super puzzled at this point, especially because if you see the tween when playing forward you should have OnUpdate spam you way more than once (and I'm sure there's no bugs with OnUpdate, it's a pretty solid system), so I need to see what else is happening. Can you repro it in a sample scene with a sample script and attach the package here? |
While this is totally possible, I was being lazy, so I procrastinated by thinking about this OnUpdate() spam situation. And I think I've found the issue. |
If you create a Tween and then try to play it backwards it doesn't work
DOTween v.1.0.770
Unity v 5.0.0f4
The text was updated successfully, but these errors were encountered: