# Sound not being triggered in Unity

**URL:** <https://qa.fmod.com/t/sound-not-being-triggered-in-unity/18762>\
**Category:** Unity\
**Created:** [May 14, 2022, 9:53am UTC](https://qa.fmod.com/t/sound-not-being-triggered-in-unity/18762 "2022-05-14T09:53:41Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Keo](https://avatars.discourse-cdn.com/v4/letter/k/dbc845/32.png) [@Keo](https://qa.fmod.com/u/Keo)\
**Post date:** [May 14, 2022, 9:53am UTC](https://qa.fmod.com/t/sound-not-being-triggered-in-unity/18762/1 "2022-05-14T09:53:41Z")

</div>

Hi all 🙂 ,

I´m trying to play a Oneshot sound when an enemy is defeated (parameter HP \<=0).  
I´ve added a component FMOD emitter to the enemy object and a FMOD parameter trigger as well.  
The enemy object has a rigibody 2D and a Collision 2D components.

My approach to play the sound was:

**FMOD event emitter**  
Play event: Collision 2D Enter  
Stop event: Collision 2D Exit.  
**FMOD parameter trigger**  
Target: The enemy (who´s also the emitter).  
Collision tag: Enemy (the same of the game object).  
Trigger: Trigger enter 2D.  
event parameter (HP) is active and set to 0.

Thing is the sound is not playing.

I thought that maybe FMOD is not getting right the stat of the HP so the program is unable to understand when the sound must be triggered.

This is the code of the HP stat:

```auto
public class Stats : MonoBehaviour
    {
        //Death event call when player or somebody hp <= 0 
        public delegate void DeathEvent();
        public DeathEvent OnDeath;

        public StatsData statsData = new StatsData();

        //Damage method
        public void GetDamage(float damage)
        {
            statsData.HP -= damage; //Subtract damage from hp

            if (gameObject.tag == "Player") //if player
                UIManager.Instance.UpdateHP(statsData.HP); //Update UI

            if (statsData.HP <= 0) 
            {
                Death();
            }
        }

        //Death method
        public void Death()
        {
            OnDeath();
        }

    }

```

Any help?

Thank you 🙂

---

<div class="post-metadata">

**Author:** ![jeff\_fmod](https://yyz2.discourse-cdn.com/flex036/user_avatar/qa.fmod.com/jeff_fmod/32/1766_2.png) [@jeff\_fmod](https://qa.fmod.com/u/jeff_fmod)\
**Post date:** [May 18, 2022, 12:17am UTC](https://qa.fmod.com/t/sound-not-being-triggered-in-unity/18762/2 "2022-05-18T00:17:53Z")

</div>

You cannot have two components on a single game object with one set to Trigger and the other set to Collision because Triggers and Collisions are mutually exclusive in Unity. I’m guessing no sound is playing because you have _Is Trigger_ ticked on the collider, and therefore no “Collision Enter 2D” or “Collision Exit 2D” events can occur to start the Event Emitter.  
Here are your options to get this working:

- Have both components use “Trigger Enter” and tick _Is Trigger_ on the collider.
- Have both components use “Collision Enter 2D” and untick _Is Trigger_ on the collider.
- Create two separate game objects childed to a single parent game object
  - One with the Parameter Trigger set to “Trigger Enter” and _Is Trigger_ ticked on the collider
  - One with the Event Emitter set to “Collision Enter 2D” and _Is Trigger_ unticked on the collider
