How do I change the event in FMOD Studio Event Emitter through C#? It keeps playing the same previous event

(Andrew Bushnell) #1

So I’m making an action rpg in which I’d like to have interactable music with the player. Essentially we have our sound track set up with multiple loops that have parameters to slowly add them. With triggers in the scene the loops slowly get added on when the Studio Event Emitter. So when I transition into another scene, I thought it’d be pretty simple to change the Event by changing the string. So I create a script to manage the music, had it grab the Studio Event Emitter on the player, called Stop(), changed the path, then called Play().

The issue is this doesn’t work. Once I transition between scenes it will stop but will play the same previous event instead of the updated event. I figured maybe I had to call something in the Event Emitter to refresh it, but when I debugged the emitter it would be using the new path all the way up to Instance.Start(). LookUp() seems to call to change the eventDescription with the new path, and it creates an instance from this new path. So my question is, why isn’t this new path working? Is there something I need to change? Something I need to add to my code? Please help me, I’ve looked through a ton of forums and couldn’t find any related issues or answers.

(Andrew Bushnell) #2

I ended up finding a solution, but I don’t like how not pretty it is as I had to mess around with the code with Studio Event Emitter.

In the Studio Event Emitter, I went into the Play() method and added:

The issue was that essentially the eventDescription was not being updated even though the string had changed because the LookUp() method only played when the eventDiscription was not valid. It’s pretty annoying how hard it was just to change an event between scenes, I would’ve though there would have been an easier method for this. Oh well.

(Cameron Baron) #3

It looks like what you have done is currently the only way to re-use a StudioEventEmitter, although this should be easy to fix.

My first thought would be to expose a function that takes a string, the new event, and updates the event description. Because doing too many things in Play() can cause undesirable delays, more noticeable on some platforms.

public void ChangeEvent(string newEvent)
Event = newEvent;

This is only an initial thought and would require further testing, but it should do the job for now.

(Shuaiying Hou) #4

I think FMOD should definitely fix this issue since it’s quite common to re-use SEE and it makes zero sense to create a new instance every time.