Wonder if someone could help me. I’m having an issue plying multiple audio sources on my enemy tank prefabs .
I have added two audio sources (which play just fine elsewhere in the game). I then attach my two audio source components to my script component (below). However, only the first sound will play.
public AudioSource hitAudioClip;
public AudioSource deathAudioClip;
Start ()
{
AudioSource[] audioSources = GetComponents<AudioSource>();
hitAudioClip = audioSources[0];
deathAudioClip = audioSources[1];
}
TakeDamage()
{
hitAudioClip.Play ();
}
EnemyDeath()
{
deathAudioClip.Play ();
}
I’ve read a few posts which point at doing it just like this, but I just cant get it to play the second sound. I’m beginning to think it might be some sort of unity bug…?
Am I doing something wrong?
Thanks in advance,
Dave