unity-game-enginedotween

Unity dotween delay before the next append not working


I have lists of data and I am trying to tween them by sequence. If I put a delay for each of the tween it will not work. What I try to achieve is inserting the delay before the next sequence.

private IEnumerator<float> _CameraTransition()
{
    var camSequence = DOTween.Sequence();

    for (int i = 0; i < CamerasData.Count; i++)
        camSequence.Append(cam.DOFieldOfView(CamerasData[i].fov, CamerasData[i].duration).SetDelay(CamerasData[i].triggerDelay));

    camSequence.Play();
    yield return 0;
}

If I remove the SetDelay it works, but of course no delay


Solution

  • (NOTE: I'm the developer of the library the OP is talking about)

    The correct way to add delays inside a Sequence is to use AppendInterval on the Sequence itself.

    for (int i = 0; i < CamerasData.Count; i++) {
       camSequence
          .AppendInterval(CamerasData[i].triggerDelay)
          .Append(cam.DOFieldOfView(CamerasData[i].fov, CamerasData[i].duration));
    }
    

    That said, SetDelay should also work in theory, even if it's not recommended. I will add it to my to-check list.