Skip to content

Is there a way to execute code when a Tween or Sequence starts (OnStart equivalent)? #90

Answered by KyryloKuzyk
ZedDevStuff asked this question in FAQ
Discussion options

You must be logged in to vote

This question is closely tied to the one about animation caching: #88

Animation caching is possible with PrimeTween as described in the link above, but that's not a recommended way of playing animations. Instead, a simpler approach is to create an animation at the exact moment you need it. So if you do it the recommended way, then the question about OnStart() callback goes away because you can just call a method right before you start the animation:

DoSomethingBeforeAnimation();
Tween.Position(...);

But if you still want to go in the path of caching animations, then you can chain a callback before other animations in a Sequence. This will have the same effect as DOTween's OnStart() callback:

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@ZedDevStuff
Comment options

Answer selected by KyryloKuzyk
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
FAQ
Labels
None yet
2 participants