# How to save event instance reference to a new level

**URL:** https://qa.fmod.com/t/how-to-save-event-instance-reference-to-a-new-level/14427
**Category:** Unreal Engine
**Created:** [March 9, 2019, 8:01pm UTC](https://qa.fmod.com/t/how-to-save-event-instance-reference-to-a-new-level/14427 "2019-03-09T20:01:08Z")
**Posts on this page:** 6
**Page:** 1

<div class="post-metadata">

### Author: ![lionclop](https://avatars.discourse-cdn.com/v4/letter/l/bb73d2/32.png) [@lionclop](https://qa.fmod.com/u/lionclop)
#### Post date: [March 9, 2019, 8:01pm UTC](https://qa.fmod.com/t/how-to-save-event-instance-reference-to-a-new-level/14427/1 "2019-03-09T20:01:08Z")

</div>

Hey peeps!

I’ve got this scenario and struggle trying to find the solution:  
I play an event (which is set to be looping) and save the instance into a variable into my Game Instance.  
Open a new level.  
Event keeps playing and looping.  
When I want to stop it during one of the moments on that level, I get back to my Game Instance, take the variable of this FMOD event instance, and try to stop it, with no success.  
This works, if done on the same level, however.

Any ideas why that happening?  
I mean, I expect UE4 to kill everything when you load a new level, but I somehow FMOD events keep playing, which probably means UE4 does not touch them? If so, how do I control them on a new level?

---

<div class="post-metadata">

### Author: ![cameron-fmod](https://yyz2.discourse-cdn.com/flex036/user_avatar/qa.fmod.com/cameron-fmod/32/261_2.png) [@cameron-fmod](https://qa.fmod.com/u/cameron-fmod)
#### Post date: [March 14, 2019, 2:12am UTC](https://qa.fmod.com/t/how-to-save-event-instance-reference-to-a-new-level/14427/2 "2019-03-14T02:12:04Z")

</div>

I would also expect it to work the way you do, although it will depend on how the Event is played.

Are you using the FMODAudioComponent or creating an Event manually in code or blueprints?

---

<div class="post-metadata">

### Author: ![lionclop](https://avatars.discourse-cdn.com/v4/letter/l/bb73d2/32.png) [@lionclop](https://qa.fmod.com/u/lionclop)
#### Post date: [March 14, 2019, 3:58am UTC](https://qa.fmod.com/t/how-to-save-event-instance-reference-to-a-new-level/14427/3 "2019-03-14T03:58:40Z")

</div>

Hello Cameron!

We play the sound in Level BP, with “Play Event 2D” node.  
We use “Event Instance Stop” to stop the event.

---

<div class="post-metadata">

### Author: ![cameron-fmod](https://yyz2.discourse-cdn.com/flex036/user_avatar/qa.fmod.com/cameron-fmod/32/261_2.png) [@cameron-fmod](https://qa.fmod.com/u/cameron-fmod)
#### Post date: [March 14, 2019, 4:35am UTC](https://qa.fmod.com/t/how-to-save-event-instance-reference-to-a-new-level/14427/4 "2019-03-14T04:35:46Z")

</div>

The Play Event 2D blueprint node will not stop or cleanup a looping sound.  
It creates a FMOD Event Instance, not an Unreal Object which is why it does not get cleaned up when the level changes. If the _AutoPlay_ parameter is set, the event will be started **AND** released immediately which then renders the returned _FMODEventInstance_ useless for controlling it.

If you were to set _AutoPlay_ to false, the _FMODEventInstance_ will be valid and can be used to stop the event.

Otherwise you could use the _PlayEventAttached_ node, this creates a _FMODAudioComponent_ and attaches it to an Actor. This also gives you two options, _Stop when Attached to Destroyed_ which will stop the event when the Actor this component is attached to is destroyed. And _Auto Destroy_, this is used to clean up the component once the Event has finished playing (non-looping).

This would be much easier to know with better documentation.  
We are currently going over all of our documentation so I will make sure this is cleared up.

---

<div class="post-metadata">

### Author: ![lionclop](https://avatars.discourse-cdn.com/v4/letter/l/bb73d2/32.png) [@lionclop](https://qa.fmod.com/u/lionclop)
#### Post date: [March 14, 2019, 4:54am UTC](https://qa.fmod.com/t/how-to-save-event-instance-reference-to-a-new-level/14427/5 "2019-03-14T04:54:06Z")

</div>

Cameron,

Thanks for your thoughts!

If you would attach an event as a component to any actor in the world, during the level loading process, it would be destroyed, as any other actor, right?  
Attaching it to the Game Mode or Game Instance might work, as they are not present anywhere in the world, but in this case it’s easier to always have a component there, and simply change, play and stop events of the component through blueprints, when needed.

I like the Auto Play approach, and will try it now.

---

<div class="post-metadata">

### Author: ![lionclop](https://avatars.discourse-cdn.com/v4/letter/l/bb73d2/32.png) [@lionclop](https://qa.fmod.com/u/lionclop)
#### Post date: [June 6, 2019, 5:47am UTC](https://qa.fmod.com/t/how-to-save-event-instance-reference-to-a-new-level/14427/6 "2019-06-06T05:47:27Z")

</div>

Just a reply that this method worked.
