# Switch background music

**URL:** https://qa.fmod.com/t/switch-background-music/20057
**Category:** Unity
**Created:** [April 3, 2023, 6:50pm UTC](https://qa.fmod.com/t/switch-background-music/20057 "2023-04-03T18:50:19Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![ZihanXu](https://avatars.discourse-cdn.com/v4/letter/z/2acd7d/32.png) [@ZihanXu](https://qa.fmod.com/u/ZihanXu)
#### Post date: [April 3, 2023, 6:50pm UTC](https://qa.fmod.com/t/switch-background-music/20057/1 "2023-04-03T18:50:19Z")

</div>

Hello, I have several pieces of BGM and I want to switch from one to another. How should I do that?  
I have tried change the eventinstance of emitter but it didn’t work.

Thanks.

---

<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 4, 2023, 1:41am UTC](https://qa.fmod.com/t/switch-background-music/20057/2 "2023-04-04T01:41:07Z")

</div>

Hi,

What version of FMOD are you using?

How are you playing the first BGM event? Could I get a code snippet of how you are trying to change events?

---

<div class="post-metadata">

### Author: ![luffyklose](https://avatars.discourse-cdn.com/v4/letter/l/58956e/32.png) [@luffyklose](https://qa.fmod.com/u/luffyklose)
#### Post date: [April 4, 2023, 11:17pm UTC](https://qa.fmod.com/t/switch-background-music/20057/3 "2023-04-04T23:17:39Z")

</div>

Fmod version is 2.02.11.

I set up event in the inspector and control it in Start method:

> private void Start()  
> {  
> musicEmitter.Play();  
> isPlaying = true;  
> }

Here’s my ChangeMusic method:

> public void ChangeMusic(string eventName)  
> {  
> musicEmitter.Stop();  
> musicEmitter.Event = eventName;  
> musicEmitter.Play();  
> }

---

<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 5, 2023, 11:16pm UTC](https://qa.fmod.com/t/switch-background-music/20057/4 "2023-04-05T23:16:44Z")

</div>

Hi,

`Emitter.Event` has been deprecated and won’t change the event the emitter will play.

I would recommend making a public list of emitters:

```auto
public List<FMODUnity.StudioEventEmitter> emitters = new List<FMODUnity.StudioEventEmitter>();

```

You can then iterate through to start and stop:

```auto
emitters[0].Stop();
emitters[1].Play();

```

Let me know if this works for you, there are some other options too.

Hope this helps!
