dotween
dotween copied to clipboard
OnComplete does not work for Sequence which setLoops(-1)...
public class TestKillSequenceOnCompleted : MonoBehaviour {
public GameObject Cube;
private void Start()
{
Sequence cubSeq = DOTween.Sequence();
cubSeq.Append(Cube.transform.DOMoveZ(5, 2.0f));
cubSeq.Append(Cube.transform.DOMoveZ(0, 2.0f));
//cubSeq.SetLoops(-1); //if SetLoops(-1) ,OnComplete() will not be triggered.
cubSeq.OnComplete( () => {Debug.Log("Cub Complete");});
StartCoroutine(KillDelay(cubSeq, 3.0f));
}
IEnumerator KillDelay(Sequence seq, float delay)
{
yield return new WaitForSeconds(delay);
Debug.Log("Kill");
seq.Kill(true);
}
}
https://github.com/Demigiant/dotween/issues/64
Thanks