# Stopping a one shot from repeating on animation event in Unity

**URL:** <https://qa.fmod.com/t/stopping-a-one-shot-from-repeating-on-animation-event-in-unity/15920>\
**Category:** Unity\
**Created:** [June 26, 2020, 8:47pm UTC](https://qa.fmod.com/t/stopping-a-one-shot-from-repeating-on-animation-event-in-unity/15920 "2020-06-26T20:47:52Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Husmanmusic](https://avatars.discourse-cdn.com/v4/letter/h/b5ac83/32.png) [@Husmanmusic](https://qa.fmod.com/u/Husmanmusic)\
**Post date:** [June 26, 2020, 8:47pm UTC](https://qa.fmod.com/t/stopping-a-one-shot-from-repeating-on-animation-event-in-unity/15920/1 "2020-06-26T20:47:52Z")

</div>

Hi there, I’m loving FMOD so far, however I can’t seem to get it to work with the footsteps of my character. I attached a simple script to the character, which basically triggers a oneshot from FMOD on the animation event once the character hits the ground. however, once the character stops walking, the oneshot keeps repeating itself. this is the script:

public class FootstepsAudio : MonoBehaviour  
{

```
[FMODUnity.EventRef]
public string inputsound;

public void PlaySound()
{
	FMODUnity.RuntimeManager.PlayOneShot(inputsound); //This sound plays when Enemy is hit
	
}

```

}

I hope anyone can help me out,

Thanks in advance!

---

<div class="post-metadata">

**Author:** ![alexzzen](https://yyz2.discourse-cdn.com/flex036/user_avatar/qa.fmod.com/alexzzen/32/6825_2.png) [@alexzzen](https://qa.fmod.com/u/alexzzen)\
**Post date:** [June 26, 2020, 9:14pm UTC](https://qa.fmod.com/t/stopping-a-one-shot-from-repeating-on-animation-event-in-unity/15920/2 "2020-06-26T21:14:16Z")

</div>

Have you checked your animations? This sounds like the animation containing the animation event is running even when your character stops walking.

---

<div class="post-metadata">

**Author:** ![Husmanmusic](https://avatars.discourse-cdn.com/v4/letter/h/b5ac83/32.png) [@Husmanmusic](https://qa.fmod.com/u/Husmanmusic)\
**Post date:** [June 26, 2020, 9:16pm UTC](https://qa.fmod.com/t/stopping-a-one-shot-from-repeating-on-animation-event-in-unity/15920/3 "2020-06-26T21:16:13Z")

</div>

Thank you for your reply, I checked and my character goes to the idle animation after stopping. But could it be because I’m using a blendtree? That it somehow still slowly plays the animation in the background or anything?

---

<div class="post-metadata">

**Author:** ![Husmanmusic](https://avatars.discourse-cdn.com/v4/letter/h/b5ac83/32.png) [@Husmanmusic](https://qa.fmod.com/u/Husmanmusic)\
**Post date:** [June 26, 2020, 9:20pm UTC](https://qa.fmod.com/t/stopping-a-one-shot-from-repeating-on-animation-event-in-unity/15920/4 "2020-06-26T21:20:53Z")

</div>

Yes I think it’s due to the blendtree, since if I don’t use a blendtree for my player and seperate the idle and run animation, it doesn’t happen.

---

<div class="post-metadata">

**Author:** ![alexzzen](https://yyz2.discourse-cdn.com/flex036/user_avatar/qa.fmod.com/alexzzen/32/6825_2.png) [@alexzzen](https://qa.fmod.com/u/alexzzen)\
**Post date:** [June 26, 2020, 9:30pm UTC](https://qa.fmod.com/t/stopping-a-one-shot-from-repeating-on-animation-event-in-unity/15920/5 "2020-06-26T21:30:53Z")

</div>

When using blend trees, all animation events are called. You can maybe work around that by checking for the clip weight, see [https://forum.unity.com/threads/mecanim-5-blend-tree-animation-event-called-twice.318747/](https://forum.unity.com/threads/mecanim-5-blend-tree-animation-event-called-twice.318747/)
