/// <summary> /// Check to see if the timeout has expired, and play a new, random audioClip if it has, /// resetting the timeout. /// </summary> public void Update() { if (playing) { #if UNITY_MODULES_AUDIO if (time <= 0) { audioSource.clip = clips.Random(); audioSource.Play(); time += timeBetweenClips + audioSource.clip.length; } #endif time -= Time.unscaledDeltaTime; } }