Skip to content
Discussion options

You must be logged in to vote

That's a great question and actually a fundamental part of PrimeTween :)

As you correctly pointed out, returning ReusableTween reference to the user is not an option. Because if a user saves the reference and ReusableTween is reused for another animation, the stored reference would point to a wrong animation. Interestingly enough, DOTween behaves like this with "Reuse tweens" option, which makes it very error prone to use.

PrimeTween solves it by storing a unique id inside the Tween struct along with a ReusableTween tween reference. The Tween is then considered isAlive when its id == tween.id and each public API is guarded with this isAlive check:

public struct Tween {
    long id;
    Re…

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@VG3O
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