So, yes. That is what i have tried the delayScriptAudio variable is just starting the audio. but the problem is that the while loop stops everything else untill its done. for example stops movement
That is not what you have tried. Your while loop does not include a yield statement. In fact, yours never loops. It just returns on the first iteration. Also, delayAudioScript in your code is not a variable. It is a method (unless, maybe, it is a delegate, but you never listed that part of your code).
I’m glad you found a solution, but I also suggest you study coroutines a bit more, as perhaps there’s more you can do with them that you have achieved so far.
Hey, sorry first time posting. I was just trying to summarize it, thus not including everything
IEnumerator delayScriptAudio(int delay, int textNum , int audioSeq )
{
// wait for delay (seconds)
yield return new WaitForSeconds(delay);
// Text set to quote
//textMesh.SetText(textQuotes[textNum]);
// Get audio Source
source.clip = audioArray[audioSeq];
// Play audio
source.Play();
}
IEnumerator scriptTimer()
{
//First Play sequance //4
for (int i = 0; i < 4; i++)
{
StartCoroutine(delayScriptAudio(a, b, c));
yield return new WaitForSeconds(source.clip.length);
b++;
c++;
}
}