This is my problem: I want to play a random Audiosource within an array of Audiosource. And when it finishes, play another random Audiosourc from that array again.
The audiosource doesn’t have a end event, so I don’t know when it finishes and I can’t to play another Audiosource.
I try it to use:
currentlyPlayingClip = Loops[UnityEngine.Random.Range(0, Loops.Length)];
currentlyPlayingClip.Play();
yield return new WaitForSeconds(currentlyPlayingClip.clip.length);
if (isPlayingInGame)
{
StartCoroutine(PlayRandomLoop());
}
But it does a little pause between the sounds. =/
Someone have an idea?