Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 12 additions & 10 deletions Assets/LeanTween/Framework/LeanTween.cs
Original file line number Diff line number Diff line change
Expand Up @@ -627,17 +627,19 @@ public static void cancel( int uniqueId, bool callOnComplete ){
if (backId > tweens.Length - 1) { // sequence
int sequenceId = backId - tweens.Length;
LTSeq seq = sequences[sequenceId];
// Debug.Log("sequenceId:" + sequenceId+" maxSequences:"+maxSequences+" prev:"+seq.previous);

for (int i = 0; i < maxSequences; i++) {
if (seq.current.tween != null) {
int tweenId = seq.current.tween.uniqueId;
int tweenIndex = tweenId & 0xFFFF;
removeTween(tweenIndex);
if (seq.counter == backCounter) {
Copy link
Author

@DoubleLoopAndy DoubleLoopAndy Aug 22, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Without this test, an unrelated sequence can be canceled.

// Debug.Log("sequenceId:" + sequenceId+" maxSequences:"+maxSequences+" prev:"+seq.previous);

for (int i = 0; i < maxSequences; i++) {
if (seq.current.tween != null) {
int tweenId = seq.current.tween.uniqueId;
int tweenIndex = tweenId & 0xFFFF;
removeTween(tweenIndex);
}
if (seq.current.previous == null)
break;
seq.current = seq.current.previous;
}
if (seq.current.previous == null)
break;
seq.current = seq.current.previous;
}
} else { // tween
// Debug.Log("uniqueId:"+uniqueId+ " id:"+backId +" action:"+(TweenAction)backType + " tweens[id].type:"+tweens[backId].type);
Expand Down