# How to release all the event?

**URL:** <https://qa.fmod.com/t/how-to-release-all-the-event/23031>\
**Category:** Unity\
**Created:** [June 11, 2025, 9:22am UTC](https://qa.fmod.com/t/how-to-release-all-the-event/23031 "2025-06-11T09:22:09Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![MisakaCirno](https://avatars.discourse-cdn.com/v4/letter/m/e480ec/32.png) [@MisakaCirno](https://qa.fmod.com/u/MisakaCirno)\
**Post date:** [June 11, 2025, 9:22am UTC](https://qa.fmod.com/t/how-to-release-all-the-event/23031/1 "2025-06-11T09:22:09Z")

</div>

I’m trying to make a function to reset the entire game.

It would be a bit too troublesome to go through each module to find their `EventInstance` and release them one by one.

Is there a way to release all the existing `EventInstance` at present?

Should I need `Destroy()` then `Initialize()` `RuntimeManager` again?

---

<div class="post-metadata">

**Author:** ![li\_fmod](https://yyz2.discourse-cdn.com/flex036/user_avatar/qa.fmod.com/li_fmod/32/6577_2.png) [@li\_fmod](https://qa.fmod.com/u/li_fmod)\
**Post date:** [June 13, 2025, 6:08am UTC](https://qa.fmod.com/t/how-to-release-all-the-event/23031/2 "2025-06-13T06:08:15Z")

</div>

Hi,

Thank you for sharing the information.

> [@MisakaCirno](#):
>
> It would be a bit too troublesome to go through each module to find their `EventInstance` and release them one by one.
> 
> Is there a way to release all the existing `EventInstance` at present?

Currently there is no built-in method to release all active `EventInstance` globally.

At this time, the most suitable approach would be to implement a centralized manager that keeps track of all created `EventInstance`.

Generally, we recommend releasing `EventInstance` immediately after starting them, so that they are automatically cleaned up when playback ends, minimizing the need for manual management.

However, if that structure doesn’t suit your project, a possible alternative would be to:

- Use [`Studio::Bus::stopAllEvents`](https://fmod.com/docs/2.02/api/studio-api-bus.html#studio_bus_stopallevents) to stop all active events on a bus.
- Then iterate over all loaded banks using [`Studio::Bank::getEventList`](https://fmod.com/docs/2.02/api/studio-api-bank.html#studio_bank_geteventlist) to retrieve all `EventDescription`.
- Finally, call [`Studio::EventDescription::releaseAllInstances`](https://fmod.com/docs/2.02/api/studio-api-eventdescription.html#studio_eventdescription_releaseallinstances) on each one to release their active instances.

> [@MisakaCirno](#):
>
> Should I need `Destroy()` then `Initialize()` `RuntimeManager` again?

Destroying and reinitializing the `RuntimeManager` at runtime is generally not recommended, as it may lead to instability or crashes within Unity.

Hope this helps! Let me know if you have questions.

---

<div class="post-metadata">

**Author:** ![MisakaCirno](https://avatars.discourse-cdn.com/v4/letter/m/e480ec/32.png) [@MisakaCirno](https://qa.fmod.com/u/MisakaCirno)\
**Post date:** [June 13, 2025, 7:18am UTC](https://qa.fmod.com/t/how-to-release-all-the-event/23031/3 "2025-06-13T07:18:00Z")

</div>

Thank you for the suggestion. I believe your approach is likely superior to what I had in mind.

Since resetting the game won’t be a very frequent operation,

Whereas with my initial idea: using an array to track all `Event`s created via `CreateInstance`, and updating that array whenever these `EventInstance`s are `Release`d – would clearly add significant performance overhead.

---

<div class="post-metadata">

**Author:** ![MisakaCirno](https://avatars.discourse-cdn.com/v4/letter/m/e480ec/32.png) [@MisakaCirno](https://qa.fmod.com/u/MisakaCirno)\
**Post date:** [June 13, 2025, 10:38am UTC](https://qa.fmod.com/t/how-to-release-all-the-event/23031/4 "2025-06-13T10:38:25Z")

</div>

I have another question I’d like to consult you about.

* * *

Suppose an `EventInstance` is currently playing, but the `Bank` it belongs to gets Unloaded.  
At this point, a warning appears:

> [FMOD] PlaybackSystem::onDestroyEvent : Destroying event instance ‘2005a0’ due to event description {6f0e2732-db89-4496-a8d9-4c019913d480} unload

In this scenario, is the state of this `EventInstance` the same as if I had called `stop()` and then `release()` on a regular `EventInstance`?

* * *

Additionally, we are evaluating the long-term stability of our project.  
While it seems to me that an `EventInstance` is just a wrapper, and the `handle` it holds is merely an `IntPtr`,  
I want to confirm: do `EventInstance`s that have been `release()`d still occupy some system resources?  
Or does FMOD perform garbage collection (GC) on them at specific times?  
(Assuming the number of released EventInstances exceeds ten thousand.)

---

<div class="post-metadata">

**Author:** ![MisakaCirno](https://avatars.discourse-cdn.com/v4/letter/m/e480ec/32.png) [@MisakaCirno](https://qa.fmod.com/u/MisakaCirno)\
**Post date:** [June 13, 2025, 10:50am UTC](https://qa.fmod.com/t/how-to-release-all-the-event/23031/5 "2025-06-13T10:50:31Z")

</div>

Based on my observations of the `Instances` item in the Profiler, it appears consistent with my speculation.  
After `release()`, the `Instances` count rapidly drops to `0/0`.  
Similarly, after Unloading a Bank, the `Instances` count also rapidly drops to `0/0`.

This leaves me with only one point of confusion: **are the two approaches equivalent?**  
Can I achieve similar results as `release()`ing all `EventInstance`s by leveraging the method of Unloading all `Bank`s?

---

<div class="post-metadata">

**Author:** ![li\_fmod](https://yyz2.discourse-cdn.com/flex036/user_avatar/qa.fmod.com/li_fmod/32/6577_2.png) [@li\_fmod](https://qa.fmod.com/u/li_fmod)\
**Post date:** [June 16, 2025, 6:07am UTC](https://qa.fmod.com/t/how-to-release-all-the-event/23031/6 "2025-06-16T06:07:05Z")

</div>

> [@MisakaCirno](#):
>
> Suppose an `EventInstance` is currently playing, but the `Bank` it belongs to gets Unloaded.  
> At this point, a warning appears:
> 
> > [FMOD] PlaybackSystem::onDestroyEvent : Destroying event instance ‘2005a0’ due to event description {6f0e2732-db89-4496-a8d9-4c019913d480} unload
> 
> In this scenario, is the state of this `EventInstance` the same as if I had called `stop()` and then `release()` on a regular `EventInstance`?

> [@MisakaCirno](#):
>
> Can I achieve similar results as `release()`ing all `EventInstance`s by leveraging the method of Unloading all `Bank`s?

[Unloading a bank](https://fmod.com/docs/2.02/api/studio-guide.html#bank-unload) is not equivalent to manually calling `stop()` followed by `release()` on an `EventInstance`.

If a bank is unloaded while one of its event instances is still active, FMOD destroys the instance immediately, bypassing the normal stopping and releasing process. This abrupt termination can lead to incomplete cleanup and potential resource leaks.

Calling [Studio::EventInstance::release](https://fmod.com/docs/2.02/api/studio-api-eventinstance.html#studio_eventinstance_release) marks the event instance for destruction, which occurs asynchronously once the instance reaches the `STOPPED` state. This is the recommended method for managing event lifecycles.

> [@MisakaCirno](#):
>
> Or does FMOD perform garbage collection (GC) on them at specific times?  
> (Assuming the number of released EventInstances exceeds ten thousand.)

FMOD does not perform a garbage collection on `EventInstance` objects. It relies on explicit `release()` calls to free resources. Without releasing instances properly, even if playback has stopped, they can accumulate and consume memory over time.
