OnEventStopped not called when UFMODAudioComponent is destroyed while playing

#1

I don’t know if this is intentional or not, but i think OnEventStopped should be called when you destroy an UFMODAudioComponent while it’s playing an event.

#2

It does appear to be missing from that case, although wouldn’t it be better to only broadcast OnEventStopped if bStopWhenOwnerDestroyed is true?

Otherwise, if you wanted the event to continue/finish playing after the object is destroyed, you will get the OnEventStopped callback even though it hasn’t stopped.

#3

Yes, that works. Sorry i didn’t see that variable.
Everything should work as it should then :slight_smile:

#4

But then again bStopWhenOwnerDestroyed is true as default but still i don’t get the OnEventStopped broadcast when i destroy the owner.
My solution for this was to do a derived class that broadcasts OnEventStopped on EndPlay().

#5

Apologies for the delay, that does sound like something we could fairly easily add.

#6

Nice! :slight_smile:
Yeah i can see why i dont get the broadcast. The component runs Stop() when parent is destroyed and bStopWhenOwnerDestroyed == true. But the OnEventStopped broadcast is only called in Tick() with OnPlaybackCompleted() and can’t be called since bIsActive is set to false by the Stop() function.

And another thing if it’s not too much , is it possible for you to add virtual to some functions as Play(), Stop() and SetEvent() so we can override and add conditions in derived classes?

#7

We will look into the possibility of adding virtual functions to the FMODAudioComponent for a future release.

1 Like