Command instrument not stopping targeted event

Hi!

I’m having an issue when trying to stop an event triggered by a command instrument. I’m attaching the screenshot to show the event architecture. The goal is to have different events triggering the same music track to maintain nomenclatures and clarity for the unity implementation dev, while also keeping the simple stop functionality, so that the dev just stops the event and this propagates to the original track triggered in the beginning. But somehow, the stop is not working and the track keeps playing. This works if I test it inside FMOD but inside the game its not working. Maybe I’m missing something?

Thanks!

This is occurring because you’re using a command instrument instead of an event instrument.

When a command instrument is triggered, it spawns an instance of the event it targets, which is routed into the mixer and exists independently of the event instance that spawned it, and will continue to exist independently even if that parent event instance is stopped. The only way to stop an event instance started by a command instrument is to use a “stop event” command instrument. (In FMOD Studio, stopping the parent event will also stop event instances spawned from command instruments in that event, but this is purely to make auditioning events with command instruments more convenient and does not reflect in-game behavior.)

In your case, you should use event reference instruments (more commonly known as “event instruments”) instead of command instruments. Unlike event instances spawned from command instruments, the event instances spawned from event reference instruments are routed into the parent event instance and does not exist independently of that parent event instance, meaning that it will stop when the parent event stops.

To create an event instrument for an existing event in your project, drag that event from the events browser onto a track of a different event in the event editor window.

Hi! Thanks for replying and sorry for the delay. What you describe as the behavior and common use of the command instrument is actually what I’m doing in my event architecture. I’m using a command event to stop the already triggered event. I’m using this same architecture in another music event and it is working. In that case I used it because I need to have the parent event and the trigger by command instrument to be on different channel mixers. In the case related to this post is similar, and aims at reusing base music in different events with names that refer to other levels, so that the coder don’t get confused about what track to reuse where, and hence minimize errors. The triggered tracks have timeline behaviour too, so considering all this the command instrument is the best way to go. And, though using it correctly, the stop doesn’t occur when the coder stops the parent event. I thought it could be related to the loop architecture for the command event stopping the remote event and its “stopping” condition that could be causing the problem. Still, the original working case I’m citing has the same architecture. Not sure what’s happening really.

Ah - my apologies, I misread your screenshot when I first read your post.

Which FMOD_STUDIO_STOP_MODE are you using when stopping the parent event, FMOD_STUDIO_STOP_ALLOWFADEOUT or FMOD_STUDIO_STOP_IMMEDIATE? I ask because FMOD_STUDIO_STOP_IMMEDIATE will stop the event immediately without having any opportunity to trigger your “stop event” command instrument.

Also, what is the stopping behavior of the event being stopped by the command instrument? Do any of the instruments or logic markers in the event stopped by the command instrument feature event state conditions? I ask because if any instruments or logic markers in an event feature event state conditions, instances of that event do not stop immediately when stopped by a “stop event” command instrument, and instead continue playing until they reach natural ends.