Question by
RoachMotelGames · May 23, 2020 at 10:54 PM ·
audioarraysienumeratorfor-loopdialogue
How do you play an array of audio clips in sequence with dialogue system on mouse click?
I'm trying to when I talk to an NPC in my game play voice overs which are in an array when mouse button is clicked with each new line of text. So far the audio is either just restarting when clicked halfway through or just goes to the next automatically because its in a for loop.
(dialog- public audioClips[ ] voiceOvers;)
{public IEnumerator ArrayDialogue()
for (int i = 0; i < dialog.voiceOvers.Length;) {
audioSource.clip = dialog.voiceOvers[i]; audioSource.Play(); audioSource.volume = .2f;
while (audioSource.isPlaying) { yield return null;
} } }
Comment