Killing a tween, not working?
« on: January 11, 2016, 10:17:15 PM »
I have a sticker book type app that I'm creating. You can touch a sticker and drag it away from its origin position (the sticker follows under your finger), and when you let go, DOTween is used to "spring" animate the sticker back to its origin position.

This works fine but I'm wanting to add polish to this mechanic by allowing the user to touch down on the sticker before its returned to its origin from the DOTween animation and be able to drag it around again. At the moment the sticker stays under control of the Tween and won't follow your finger until the tween completes. To deal with this, I've added a DOTween.Kill(transform) that is called when the finger is touched down on the sticker, but it behaves exactly the same, the animation isn't cancelled it seems.

Any idea what I'm doing wrong or what the right way to go about this might be?

*

Daniele

  • Dr. Admin, I presume
  • *****
  • 378
    • View Profile
    • Demigiant
Re: Killing a tween, not working?
« Reply #1 on: January 12, 2016, 12:16:46 AM »
Hi!

DOTween.Kill(transform) will work only if the tween was actually created with a transform shortcut (like thatTransform.DOMove). Otherwise, you could always store the tween as a reference and kill it directly (also more efficient), with myTweenReference.Kill().

If instead you did create the tween from the transform, then the only reason it might not be working is that you're somehow recreating the tween somewhere else?

Cheers,
Daniele

Re: Killing a tween, not working?
« Reply #2 on: January 12, 2016, 01:48:18 AM »
Thank you so much, I changed over to keeping a reference to the tween and using .Kill on it and its working great now!

Thanks for being such an active developer, incredible support.

*

Daniele

  • Dr. Admin, I presume
  • *****
  • 378
    • View Profile
    • Demigiant
Re: Killing a tween, not working?
« Reply #3 on: January 12, 2016, 10:36:33 AM »
Great! And thanks for being so nice :)