Question by
mrchristopherd · Oct 10, 2016 at 08:39 PM ·
arrayaudiosourcedelay
Audio Source Array with Delay
Hi I have a script in C# that lines us some clips to play. I have got as far as working out how to play the clips using playoneshot, but I'd really like to use Playdelayed as there is an issue with the video and audio not synching up;
public AudioClip [] startsound;
public float sounddelay = 2F;
IEnumerator Start() {
AudioSource audio = GetComponent<AudioSource>();
//int random = Random.Range(0,startsound.Length);
//audio.PlayOneShot(startsound[0]);
audio.PlayDelayed(sounddelay);
yield return new WaitForSeconds(audio.clip.length);
}
As you can probably guess, I have for myself a bunch of script references copy pasted to get me going until I get this project finished so I can learn to code properly!
Comment