The behaviours of callbacks in a sequence is either bugged or unclear.
In a simple project with a monobehaviour with
public class Test : MonoBehaviour
{
public GameObject cube;
private Sequence mySequence;
private void Start()
{
mySequence = DOTween.Sequence();
mySequence.Append(cube.transform.DOMoveX(1f, 1f));
mySequence.AppendCallback(() => Debug.Log("After DoMoveX"));
mySequence.AppendCallback(() => mySequence.Pause());
mySequence.AppendCallback(() => Debug.Log("After First Pause"));
mySequence.Append(cube.transform.DOMoveY(1f, 1f));
mySequence.AppendCallback(() => Debug.Log("After DoMoveY"));
mySequence.AppendCallback(() => mySequence.Pause());
mySequence.AppendCallback(() => Debug.Log("After Last Pause"));
}
private void Update()
{
if (Input.GetKeyDown(KeyCode.Space))
mySequence.Play();
}
}
As I understand, the expected behaviour should be:
-Upon start, the Sequence is created and auto-played. (cube starts on (0;0))
-The Tweener DoMoveX moves the cube to (1;0) in 1 second.
-The callback logs "After DoMoveX"
-The sequence pauses itself
-Upon pressing space, the sequence resumes, and callback logs "After First Pause"
-The Tweener DoMoveY moves the cube to (1;1) in 1 second.
-The callback logs "After DoMoveY"
-The sequence pauses itself
-Upon pressing space, the sequence resumes, and callback logs "After Last Pause"
-The sequence completes, and auto-kills itself
But in practice:
-The callback logging "After First Pause" is never called
-The callback logging "After Last Pause" is called immediately without waiting for the sequence to resume
The behaviours of callbacks in a sequence is either bugged or unclear.
In a simple project with a monobehaviour with
As I understand, the expected behaviour should be: -Upon start, the Sequence is created and auto-played. (cube starts on (0;0)) -The Tweener DoMoveX moves the cube to (1;0) in 1 second. -The callback logs "After DoMoveX" -The sequence pauses itself -Upon pressing space, the sequence resumes, and callback logs "After First Pause" -The Tweener DoMoveY moves the cube to (1;1) in 1 second. -The callback logs "After DoMoveY" -The sequence pauses itself -Upon pressing space, the sequence resumes, and callback logs "After Last Pause" -The sequence completes, and auto-kills itself
But in practice: -The callback logging "After First Pause" is never called -The callback logging "After Last Pause" is called immediately without waiting for the sequence to resume