Please be advised that the Audiokinetic offices will close at 3:00 p.m. EST on December 22nd, 2017 for the holiday period, and will reopen on Wednesday January 3rd, 2018 at 09:00 a.m. EST. Learn more.

Community Q&A

Where Wwise users help each other out!

Audiokinetic's Community Q&A is the forum where Wwise users ask and answer questions within the Wwise community. Contact Sales if your project requires a support plan.

UE4 Plugin Crashes when swapping levels. (Fix Included)

0 votes

Since upgradiing to 2017.1.xxxx we started seeing a number of crashes in the editor (could happen in game too!) on level swap. It wasn't terribly common but I root caused it to the fact that "GetWorld" for a component in UE4 can return null when swapping levels. (I.E. the world can be in-accessible during level swap).

Apologies in advance for the formatting. I don't see support for code blocks here.

The crash would occur in this function, but that's not the best place to fix it:

template<class COMPONENT_TYPE>
void FAkAudioDevice::RemovePrioritizedComponentFromList(COMPONENT_TYPE* in_ComponentToRemove, TMap<UWorld*, COMPONENT_TYPE*>& HighestPriorityComponentMap)

 

The fix is pretty simple. Add this to FAkAudioDevice::Init

// OnWorldCleanupDelegateHandle is a new member variable I declared in FAkAudioDevice
OnWorldCleanupDelegateHandle = FWorldDelegates::OnWorldCleanup.AddLambda(
[&](UWorld* WorldBeingCleanedup, bool, bool)
{
   HighestPriorityLateReverbComponentMap.Remove(WorldBeingCleanedup);
   HighestPriorityRoomComponentMap.Remove(WorldBeingCleanedup);
}
);

and add this line to tear down

FWorldDelegates::OnWorldCleanup.Remove(OnWorldCleanupDelegateHandle); 

asked Dec 5 in Feature Requests by Brent R. (100 points)

Please sign-in or register to answer this question.

...