# Too many PlayOneShot method calls causing freezes

**URL:** <https://qa.fmod.com/t/too-many-playoneshot-method-calls-causing-freezes/14170>\
**Category:** Unity\
**Created:** [November 1, 2018, 5:43am UTC](https://qa.fmod.com/t/too-many-playoneshot-method-calls-causing-freezes/14170 "2018-11-01T05:43:43Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![botaurus](https://yyz2.discourse-cdn.com/flex036/user_avatar/qa.fmod.com/botaurus/32/127_2.png) [@botaurus](https://qa.fmod.com/u/botaurus)\
**Post date:** [November 1, 2018, 5:43am UTC](https://qa.fmod.com/t/too-many-playoneshot-method-calls-causing-freezes/14170/1 "2018-11-01T05:43:43Z")

</div>

Some of my enemies get bunched up and hit rapidly. Each hit causes a ‘FMODUnity.RuntimeManager.PlayOneShot’ to fire, resulting in thousands of PlayOneShot method calls. The frame rate gets slower and slower.  
I suspect I don’t want to be calling PlayOneShot hundreds of times in a single frame for the same sound event that’s pretty much in the same location. Is there an FMOD specific technique I can use here to play these sound events more efficiently?  
Thanks!

---

<div class="post-metadata">

**Author:** ![joseph](https://yyz2.discourse-cdn.com/flex036/user_avatar/qa.fmod.com/joseph/32/264_2.png) [@joseph](https://qa.fmod.com/u/joseph)\
**Post date:** [November 2, 2018, 12:42am UTC](https://qa.fmod.com/t/too-many-playoneshot-method-calls-causing-freezes/14170/2 "2018-11-02T00:42:08Z")

</div>

There are a few different things you could try, depending on what you need.

- Giving the event a cooldown will prevent it from triggering again for a short while after it plays. Cooldown can be set in the event macro controls.
- Setting the max instances of the event to a value less than infinity will constrain the number of simultaneous instances of that event. Max instances can be set in the event macro controls.
- It goes without saying that you could adjust your game’s code to not call FMODUnity.RuntimeManager.PlayOneShot as often as it currently does.

---

<div class="post-metadata">

**Author:** ![botaurus](https://yyz2.discourse-cdn.com/flex036/user_avatar/qa.fmod.com/botaurus/32/127_2.png) [@botaurus](https://qa.fmod.com/u/botaurus)\
**Post date:** [November 2, 2018, 12:59am UTC](https://qa.fmod.com/t/too-many-playoneshot-method-calls-causing-freezes/14170/3 "2018-11-02T00:59:35Z")

</div>

> [@](#):
>
> There are a few different things you could try, depending on what you need.
> 
> - Giving the event a cooldown will prevent it from triggering again for a short while after it plays. Cooldown can be set in the event macro controls.
> - Setting the max instances of the event to a value less than infinity will constrain the number of simultaneous instances of that event. Max instances can be set in the event macro controls.
> - It goes without saying that you could adjust your game’s code to not call FMODUnity.RuntimeManager.PlayOneShot as often as it currently does.

tyty, I’ll give those a try
