-
Notifications
You must be signed in to change notification settings - Fork 141
Open
Description
Issue Description
When canceling a LeanTween sequence immediately after adding actions, the actions continue to execute even though the sequence was canceled. This behavior suggests that the cancellation does not immediately stop the sequence, leading to unexpected outputs.
Plattform
LeanTween version 2.50
Unity 2023.2.19f1
Steps to reproduce
- Create a sequence.
- Add a delay and some actions to the sequence.
- Cancel the sequence shortly after starting it.
- Observe that the actions in the sequence still execute.
Example code
public class LeanTweenCancelTest : MonoBehaviour
{
private void Start()
{
SequenceTest();
SequenceTest();
SequenceTest();
SequenceTest();
}
private async void SequenceTest()
{
LTSeq seq = LeanTween.sequence();
Debug.Log($"[{Time.time}] Sequence started");
seq.append(1f); // 1 second delay
seq.append(() => Debug.Log($"[{Time.time}] I have started"));
seq.append(LeanTween.move(gameObject, Vector3.one, 1f));
seq.append(() => Debug.Log($"[{Time.time}] I'm done"));
await Task.Delay(100); // Wait for 100 milliseconds
Debug.Log($"[{Time.time}] Cancelling sequence with ID {seq.id}");
LeanTween.cancel(seq.id);
}
}Expected behavior
The sequence should stop immediately upon calling LeanTween.cancel, and no further actions should be executed.
console output:
[0] Sequence started
[0] Sequence started
[0] Sequence started
[0] Sequence started
[0,01999999] Cancelling sequence with ID xxxxxx
[0,01999999] Cancelling sequence with ID xxxxxx
[0,01999999] Cancelling sequence with ID xxxxxx
[0,01999999] Cancelling sequence with ID xxxxxx
Actual behavior
Despite calling LeanTween.cancel, the actions in the sequence continue to execute.
console output:
[0] Sequence started
[0] Sequence started
[0] Sequence started
[0] Sequence started
[0,01999999] Cancelling sequence with ID xxxxxx
[0,01999999] Cancelling sequence with ID xxxxxx
[0,01999999] Cancelling sequence with ID xxxxxx
[0,01999999] Cancelling sequence with ID xxxxxx
[0,9922831] I have started
[1,986698] I'm done
[1,986698] I'm done
[1,986698] I'm done
Metadata
Metadata
Assignees
Labels
No labels