- Home /
Question by
skllmyh · Jan 02, 2017 at 11:37 AM ·
unity 5audiosourceaudioclipdeath
Enemy death sound is buzzing
I want to add a death sound when enemy dies. But the audio is buzzing. Couldnt figure it out. Any idea?
#pragma strict
var DeathSound : AudioClip;
function Update () {
Death = maxHealth <= 0;
if(Death)
{
anim.SetBool("Death",true);
GetComponent.<AudioSource>().PlayOneShot(DeathSound);
EnemyManagerRandom.DeadCount +=1;
Destroy(gameObject);
}
else
{
anim.SetBool("Death",false);
}
}
Comment