UAnimationModifier derived types can be editor types, but will break standalone PIE during linker import resolution

This is launching the game in standalone PIE mode, so something like this was my reproducable case for testing.

“\Engine\Binaries\Win64\UnrealEditor.exe” “../../../GameName/GameName.uproject” /Game/GameName/Levels/TestLevel -game -PIEVIACONSOLE -Multiprocess GameUserSettingsINI=“PIEGameUserSettings0” -MultiprocessSaveConfig -forcepassthrough -messaging -SessionName=“Play in Standalone Game” -windowed -WinX=320 -WinY=267 SAVEWINPOS=1 -ResX=1280 -ResY=720

As a current workaround, we are currently using this hack, but would prefer to do something cleaner.

void FGameNameModule::StartupModule()

{

#if WITH_EDITOR

if (IsRunningGame())

{

// HACK: Prevent linker crash when AnimSequence packages contain animation modifier

// subobjects whose classes are in editor-only modules not loaded in standalone PIE.

// FixupExportMap nulls these exports before CreateExport attempts class resolution.

FCoreRedirects::AddKnownMissing(

ECoreRedirectFlags::Type_Class | ECoreRedirectFlags::Category_InstanceOnly,

FCoreRedirectObjectName(TEXT(“/Script/AnimationModifiers.AnimationModifiersAssetUserData”)),

ECoreRedirectFlags::None

);

FCoreRedirects::AddKnownMissing(

ECoreRedirectFlags::Type_Class | ECoreRedirectFlags::Category_InstanceOnly,

FCoreRedirectObjectName(TEXT(“/Script/AnimationModifiers.AnimationModifier”)),

ECoreRedirectFlags::None

);

}

#endif

[Attachment Removed]

Steps to Reproduce

  • Create UAudioFootstepAnimEventsModifier in an editor module, derived from UAnimationModifier
  • Create a blueprint that derives UAudioFootstepAnimEventsModifier, and hook it’s OnApply and OnRevert functionality to use blueprint library functions that add/remove/modify anim notify tracks on the sequence
  • Put this modifier on an animation sequence used by your game
  • Launch the game in standlone PIE mode
  • Crash in LinkerLoad::CreateExport when attempting to resolve the UAudioFootstepAnimEventsModifier type

[Attachment Removed]

Hi, thanks for reporting this. I’ve been able to repro similar issues loading modifiers, although not the specific crash that you’re hitting. But certainly, modifiers in editor modules, along with any other classes, won’t be loaded when running the editor in standalone mode. That’s because GIsEditor is false in that mode, and we use that to determine whether to load editor modules.

A different workaround for this is to force the editor module to load. You would do this from your non-editor module by doing the following:

#if WITH_EDITOR && !(UE_BUILD_SHIPPING || UE_BUILD_TEST)
	FModuleManager::Get().LoadModule(TEXT("MyAnimModifierModule"));
#endif

This is essentially the same as what we already do for the main AnimationModifiers module, which we force load in FEngineLoop::LoadPreInitModules to avoid the same kinds of issues.

[Attachment Removed]

This works perfectly to resolve our PIE standalone crashes. Thank you!

[Attachment Removed]

Great, thanks for confirming that fixed things

[Attachment Removed]