# Getting info on whether an event instance start got canceled by Cooldown macro

**URL:** https://qa.fmod.com/t/getting-info-on-whether-an-event-instance-start-got-canceled-by-cooldown-macro/22268
**Category:** Unity
**Created:** [November 6, 2024, 10:45am UTC](https://qa.fmod.com/t/getting-info-on-whether-an-event-instance-start-got-canceled-by-cooldown-macro/22268 "2024-11-06T10:45:22Z")
**Posts on this page:** 6
**Page:** 1

<div class="post-metadata">

### Author: ![JustinasNBG](https://avatars.discourse-cdn.com/v4/letter/j/e68b1a/32.png) [@JustinasNBG](https://qa.fmod.com/u/JustinasNBG)
#### Post date: [November 6, 2024, 10:45am UTC](https://qa.fmod.com/t/getting-info-on-whether-an-event-instance-start-got-canceled-by-cooldown-macro/22268/1 "2024-11-06T10:45:22Z")

</div>

I have an audio script that works very similarly to StudioEventEmitter oneShot, the flow basically goes like this:

- Call Play
- This starts an audio instance1
- Call play again (really quickly, even same frame possible)
- Audio instance1 gets all handles released and is just left to finish and play out on its own. Audio instance2 gets created and is started.
- Audio instance2 is not playing because of Cooldown restrictions
- Any variable changes now get directed to instance2, so any variable changes get applied to the sound that is not playing.

There are other solutions to this, but the simplest and most elegant one would be for me to create instance2 and try to launch it before dropping all the handles of instance1 and then if instance2 launch is not possible because of Cooldown, retain instance1. But calling start on instance2 returns FMOD.RESULT OK. Is there a way to check for this?

---

<div class="post-metadata">

### Author: ![Connor\_FMOD](https://yyz2.discourse-cdn.com/flex036/user_avatar/qa.fmod.com/connor_fmod/32/3685_2.png) [@Connor\_FMOD](https://qa.fmod.com/u/Connor_FMOD)
#### Post date: [November 7, 2024, 11:32pm UTC](https://qa.fmod.com/t/getting-info-on-whether-an-event-instance-start-got-canceled-by-cooldown-macro/22268/2 "2024-11-07T23:32:49Z")

</div>

Hi,

Thank you for the detailed explanation.

An option could be assigning a callback to the event instance and making sure that `FMOD_STUDIO_EVENT_CALLBACK_STARTED` ([FMOD engine | Studio API Reference - FMOD\_STUDIO\_EVENT\_CALLBACK\_TYPE](https://fmod.com/docs/2.02/api/studio-api-eventinstance.html#fmod_studio_event_callback_type)) is hit before releasing references to `instance1`? An example of assigning a callback can be found here: [Unity Integration | Scripting Examples - Programmer Sounds](https://fmod.com/docs/2.02/unity/examples-programmer-sounds.html).

If this does now meet your needs, would it be possible to share the code?

---

<div class="post-metadata">

### Author: ![JustinasNBG](https://avatars.discourse-cdn.com/v4/letter/j/e68b1a/32.png) [@JustinasNBG](https://qa.fmod.com/u/JustinasNBG)
#### Post date: [November 8, 2024, 10:21am UTC](https://qa.fmod.com/t/getting-info-on-whether-an-event-instance-start-got-canceled-by-cooldown-macro/22268/3 "2024-11-08T10:21:12Z")

</div>

Hmm, thanks! I’ll try it. Although if it’s a callback that happens later and is not instant, this implies that I’ll need to keep an entire queue of instances awaiting the swap (since there can be multiple calls to play a new instance) and that queue will have to clean itself out. But thanks, I’ll give it a go and see how this turns out.

---

<div class="post-metadata">

### Author: ![lnw\_bweber](https://yyz2.discourse-cdn.com/flex036/user_avatar/qa.fmod.com/lnw_bweber/32/6482_2.png) [@lnw\_bweber](https://qa.fmod.com/u/lnw_bweber)
#### Post date: [April 23, 2025, 9:27pm UTC](https://qa.fmod.com/t/getting-info-on-whether-an-event-instance-start-got-canceled-by-cooldown-macro/22268/4 "2025-04-23T21:27:45Z")

</div>

Hi there,  
I have a follow-on question about this; are there any means of determining when the invalid instance is destroyed? It seems that it doesn’t issue any EVENT\_CALLBACK\_TYPE after the initial start attempt, though I do see in profiler that it gets immediately removed.

This would be useful for cleaning out the queue like the OP mentions.

---

<div class="post-metadata">

### Author: ![Connor\_FMOD](https://yyz2.discourse-cdn.com/flex036/user_avatar/qa.fmod.com/connor_fmod/32/3685_2.png) [@Connor\_FMOD](https://qa.fmod.com/u/Connor_FMOD)
#### Post date: [April 24, 2025, 3:00am UTC](https://qa.fmod.com/t/getting-info-on-whether-an-event-instance-start-got-canceled-by-cooldown-macro/22268/5 "2025-04-24T03:00:57Z")

</div>

Hi,

> [@lnw\_bweber](#):
>
> are there any means of determining when the invalid instance is destroyed?

The [FMOD Engine | Studio API Reference - FMOD\_STUDIO\_EVENT\_CALLBACK\_STOPPED](https://fmod.com/docs/2.02/api/studio-api-eventinstance.html#fmod_studio_event_callback_type:~:text=playing.%20Parameters%20%3D%20unused.-,FMOD_STUDIO_EVENT_CALLBACK_STOPPED,-The%20event%20has) should be triggered at the end of the instances life.

> [@lnw\_bweber](#):
>
> It seems that it doesn’t issue any EVENT\_CALLBACK\_TYPE after the initial start attempt

Are you able to share the code you are testing?

---

<div class="post-metadata">

### Author: ![lnw\_bweber](https://yyz2.discourse-cdn.com/flex036/user_avatar/qa.fmod.com/lnw_bweber/32/6482_2.png) [@lnw\_bweber](https://qa.fmod.com/u/lnw_bweber)
#### Post date: [April 24, 2025, 4:04pm UTC](https://qa.fmod.com/t/getting-info-on-whether-an-event-instance-start-got-canceled-by-cooldown-macro/22268/6 "2025-04-24T16:04:33Z")

</div>

Oh whoops, I didn’t check the callback mask I was sending it. It looks like it does issue a START\_FAILED almost immediately. Thanks!
