# ERR\_INVALID\_HANDLE after loading scenes

**URL:** <https://qa.fmod.com/t/err-invalid-handle-after-loading-scenes/20136>\
**Category:** Unity\
**Created:** [April 19, 2023, 10:26am UTC](https://qa.fmod.com/t/err-invalid-handle-after-loading-scenes/20136 "2023-04-19T10:26:55Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![shishui](https://avatars.discourse-cdn.com/v4/letter/s/5f8ce5/32.png) [@shishui](https://qa.fmod.com/u/shishui)\
**Post date:** [April 19, 2023, 10:26am UTC](https://qa.fmod.com/t/err-invalid-handle-after-loading-scenes/20136/1 "2023-04-19T10:26:56Z")

</div>

```auto
[FMOD] EventInstance::release(2116352) returned ERR_INVALID_HANDLE for STUDIO_EVENTINSTANCE (0x204B00).

```

After I switch scenes, some scenes get this error and some don’t.  
And I’ve checked that Scene A only uses the StudioEventEmitterz Component to control the audio, but it still gives this error when I switch to Scene A.  
Sometimes there is more than one of this errors after switching scenes.

And one strange thing is that when my version of Fmod for Unity was 2.02.11, these errors would affect the playback of the audio, but when updated to 2.02.13, the errors would still appear but not affect the audio playback.

Following is my version:  
Unity 2020.3.19f1  
Fmod for unity:2.02.13 (previously 2.02.11)  
Fmod Studio: 2.02.11

---

<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 19, 2023, 11:57pm UTC](https://qa.fmod.com/t/err-invalid-handle-after-loading-scenes/20136/2 "2023-04-19T23:57:50Z")

</div>

Hi,

When you say `switch scenes` is this in play mode or while just working on scenes?

> [@shishui](#):
>
> StudioEventEmitterz Component to control the audio

Could you elaborate on what you mean by this?

> [@shishui](#):
>
> these errors would affect the playback of the audio

What were the effects you were experiencing? Was the audio stopping or distorting in some way?

---

<div class="post-metadata">

**Author:** ![shishui](https://avatars.discourse-cdn.com/v4/letter/s/5f8ce5/32.png) [@shishui](https://qa.fmod.com/u/shishui)\
**Post date:** [April 20, 2023, 4:16am UTC](https://qa.fmod.com/t/err-invalid-handle-after-loading-scenes/20136/3 "2023-04-20T04:16:38Z")

</div>

Hi,  
It’s in play mode.  
The effect is audio stopping but only the BGM stopping which is DONTDESTROY,SFXs were not being affected.  
The BGM will stop only when the error is reported a second time, and will still be playing when the error is reported the first time.（onlt when the version was 2.02.11）

After I updated to 2.02.13,BGM won’t stop.

---

<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 20, 2023, 5:18am UTC](https://qa.fmod.com/t/err-invalid-handle-after-loading-scenes/20136/4 "2023-04-20T05:18:35Z")

</div>

Hi,

Thanks for the information. Could I see a code snippet that is causing the error to be thrown? Or what are you trying to do to the event that is causing the error?

---

<div class="post-metadata">

**Author:** ![shishui](https://avatars.discourse-cdn.com/v4/letter/s/5f8ce5/32.png) [@shishui](https://qa.fmod.com/u/shishui)\
**Post date:** [April 20, 2023, 5:36am UTC](https://qa.fmod.com/t/err-invalid-handle-after-loading-scenes/20136/5 "2023-04-20T05:36:56Z")

</div>

Hi,  
Thank for your replay.  
The error occurs immediately after switching to a new scene, at which point I have no code control or expected event effect. And in the scene where the error is reported, I am not using code to control the Eventinstance, all I am using is StudioEventEmitter.  
I observed that the error was reported as Eventinstance::release, is it possible that there was a problem with the Eventinstance release in the previous scene?

---

<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 20, 2023, 5:42am UTC](https://qa.fmod.com/t/err-invalid-handle-after-loading-scenes/20136/6 "2023-04-20T05:42:42Z")

</div>

Thank you for clarifying, and you are calling `DoNotDestroy()` on the `EventEmitter` that is triggering the error. It sounds like the reference to the original instance is being lost when transitioning between scenes. It might be worth keeping track of the `EventInstance` yourself. This scripting example explains how to start and `EventInstance` using a `EventReference`: [Unity Integration | Scripting Examples - Basic](https://fmod.com/docs/2.02/unity/examples-basic.html).

Hope this helps!
