I’m not sure why this is working. It seems that I am able to play AudioClips referenced in the script without having an AudioSource on the GameObject. In fact, I don’t have an AudioSource anywhere in the scene.
I’m happy that it’s working, but confused as to why. Any help?
using UnityEngine;
using System.Collections;
using System.Collections.Generic;
public class GramGram : MonoBehaviour {
public List <AudioClip> audioClips = new List <AudioClip> ();
// Update is called once per frame
void Update () {
if (Input.GetButtonDown ("Fire1")) {
StartCoroutine ("Speak");
}
}
IEnumerator Speak () {
foreach (AudioClip clip in audioClips) {
AudioSource.PlayClipAtPoint (clip, transform.position);
yield return new WaitForSeconds (clip.length + 1f);
}
}
}