Dialogues: wait for seconds or tap

Hi!
I’m developing my first mobile game and i’m struggling with dialogues:
I made a container for the dialogue nodes called dialogue (wow… creativity at its finest…) which has a function like this:

public IEnumerator unravelDialogue()
{
//doStuff
//foreach node{
//do more stuff
yield return new WaitForSeconds(element.seconds);
}
}

point is i need to waitForSeconds OR for a tap… i was planning to use a
bool active
and convert the foreach like this:

//foreach node{
//do more stuff
startCoroutine(functionThatWaitsAndSetsActiveToFalse());
while(active)
yield return null;
}

and add a function for the tap (or any generic forceSkip)

is there a better way to do this? Cause this way if i start, let’s say 10 dialogues in 1 sec which last 10 seconds each, i’ll have 10 coroutines open for nothing

use code tags:

As for your problem, don’t use WaitForSeconds.

Instead have a while loop, and a counter.

float t = 0f;
while(t < dur)
{
     if(testForTap()) break;
     yield return null;
     t += Time.deltaTime;
}

//continue on