Freeze on Game Exit

Hi, I am using the current latest FMOD Plugin for UE5.7 and whenever I exit the game in PIE the game freezes indefinitely. Here is the last log entry, I always have to close the engine via task manager. I have the assumption that I have to release certain sounds as I am not always using the UFMODAudioComponent ut often do programmer sound handling via the callbacks the fmod api offers. In what situation do I have to release sounds manually? How can I debug such a situtation?

[2026.01.08-14.20.53:211][969]LogFMOD: Warning: C:\buildagent1\work\c1c3f17eb167c494\studio_api\src\fmod_playback_event.cpp(2939) - Event instance has programmer sounds pending release, update thread will be blocked until programmer sounds are released.

Best regards.

P.S. This only happens using using “ESC” to escape PIE, using the regular “quit game” function has no trouble.

The FMODAudioComponent handles all the creation and cleanup when using programmer sounds through it, so if you aren’t using it then any sounds you create you will be responsible for, eg. creating sounds inside callbacks for programmer instruments.

Generally this is done from the FMOD_STUDIO_EVENT_CALLBACK_DESTROY_PROGRAMMER_SOUND callback, although the event may need to be stopped first to trigger this callback.

@cameron-fmod
Ok, sorry for my bazillion edits and deletion. I can now say for sure what the problem is:

I have a custom DSP, and I have to put the Unreal Engine EventInstance that FMOD creates into this DSP as a pointer, because the DSP sets a parameter (it calculates) inside the EventInstance.

When Unreal Engine eg. crashes or ends PIE, then before Unreal Engine is able to call EndPlay on my actor the EventInstance is already destroyed but it seems like DSP still runs (perhaps in the FMOD mixer thread) and thus accesses the invalid EventInstance pointer. Apparently there is also no callback by FMOD that early enough gets called so I can set this pointer to a nullptr.

If I had at least native access to the EventInstance inside the FMOD plugin without doing all this pointer spaghetti that wouldn’t be a problem, so what can I do about this?

A while back we were having the same issue with EndPlay in our FMODAudioComponents, and our solution was to create a “shutdown” function that we could register to be called at the end of Play-In-Editor:

void UFMODAudioComponent::BeginPlay()
{
#if WITH_EDITOR
    IFMODStudioModule::Get().PreEndPIEEvent().AddUObject(this, &UFMODAudioComponent::Shutdown);
#endif
    ...
}

The problem was that when PIE ends, we need to clean things up and EndPlay was triggering too late.

Thanks for the answer, in case of EndPlay of PIE this solution works as well:

#if WITH_EDITOR
#include "Editor.h"
#endif

#if WITH_EDITOR
FEditorDelegates::EndPIE.AddUObject(this, &UMyGameInstance::OnEndPIE);
#endif

But that doesn’t handle the case of a crash in any environment (Editor, Shipping,…) for me. Do you have a solution for that case?