I have an animation and have this script on that gameobject. It will play sound at certain points during my animation, using the animation event function. It works great! however, I would like more than 1 audio clip on this animation. When i try and add more audio sources to my object and more animation events, I can only chose one sound to play. I have searched for answers to this and can not find anything. please help.
function PlaySound()
{
GetComponent.<AudioSource>().Play();
}
Instead of calling multiple functions, you can call the same function and pass different audio clip like this
public AudioSource audioSource;
public void PlayAudio(AudioClip audio)
{
audioSource.PlayOneShot(audio);
}
then you can select every animation event and select the target audio clip