Skip to content

How to build Sequence using While loop? #110

Answered by KyryloKuzyk
OmarVector asked this question in General
Discussion options

You must be logged in to vote

You can use Sequence.Chain() and chail all path positions one after another, like this:

var sequence = Sequence.Create();
while (stationPathNodes.Count != 0) {
    Vector3 pathNode = stationPathNodes.Dequeue();
    sequence.Chain(Tween.Position(transform, pathNode, duration));
}

// wait for the whole Sequence if needed
yield return sequence.ToYieldInstruction();

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@OmarVector
Comment options

Answer selected by OmarVector
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
2 participants