onKill callback such like on complete #132
Berat-Sahin
started this conversation in
Ideas
Replies: 1 comment
-
Hey, There is no OnKill() method in PrimeTween for multiple reasons. First, if you stop the tween via tween reference, then you can execute any method right at that place where you stop the tween. This will also make the code easier to follow because you'll prevent a spooky action at a distance. Here is an example: // PrimeTween doesn't have OnKill(), this is a hypothetical example
var tween = Tween.PositionX(transform, endValue, duration)
.OnKill(() => DoSomething());
// ...
// Calling 'Stop()' will trigger 'DoSomething()', which may be unexpected
tween.Stop();
// Instead, a better alternative to the code above would be the next one
var tween = Tween.PositionX(transform, endValue, duration);
// ...
tween.Stop();
DoSomething(); The second reason why PrimeTween doesn't support |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hi,
I am tweening my objects and if it has already ongoing tween on its transform, I kill it via my tween reference. It works nicely th
I also need a logic if an active tween is killed.
I implemented upper layer for handling such cases. However, It would be so nice if I had a method that I can subscribe on kill.
Wondered if it is possible to add this feature? or is it already available and I missed it?
Beta Was this translation helpful? Give feedback.
All reactions