Question by
Krystian223 · Jul 20, 2021 at 10:01 PM ·
unity 52d gameaudiosourceaudiocliptop down shooter
My sound effect is not playing
So, my Sound Effect is not playing. Here is my code that Destroys enemy if health is 0 and makes explosion sound:
if(health <= 0)
{
enemyAudioSource.PlayOneShot(explodeSound, volume);
Instantiate(effect, transform.position, Quaternion.identity);
Instantiate(effect2, transform.position, Quaternion.identity);
Destroy(gameObject);
}
Here is sound effect code:
public AudioClip explodeSound;
public AudioSource enemyAudioSource;
(I have also shoot sound effect that works but my explosion effect does not).
Comment
Your answer
Follow this Question
Related Questions
Precisely timestamping when audio leaves speaker 0 Answers
My audio doesn't play, I'm through my options... 1 Answer
Audio Source stop playing even with "DontDestroyOnLoad" 0 Answers
Please help! Audio not working in another class.. 0 Answers
Could someone help me with adding Audio to this code? (Is for a 2D game platformer) 0 Answers