How do I set C++ animation blueprint without getting a fatal error?

// load the animation blueprint
const ConstructorHelpers::FObjectFinder AnimObj(TEXT(“AnimBlueprint’/Game/MixamoAnimPack/Mixamo_Maw/Anims/MixamoAnimBP_Maw.MixamoAnimBP_Maw’”));

 // generated class is important here :)
 GetMesh()->SetAnimInstanceClass(AnimObj.Object->GeneratedClass);

This is an example of what I did, and it works perfectly fine in the editor, but once I compile to an .exe file, I received a fatal error without any other error messages. Is there an explanation as to why this is happening, and possibly a way to fix it? I am using UE4 version 4.9 and Visual C++ 2013 Professional edition.

Hi, I ran into same problem and got confused, then I looked in the engine examples - templates!
The trick is to use FClassFinder instead of FObjectFinder , and you add your animation instance class name instead of UAnimBlueprint.

const ConstructorHelpers::FClassFinder<UJumpyFrogsAnimInstance> FrogAnimBP(TEXT("/Game/Characters/FrogChar/Blueprints/Frog_AnimationBP"));
	if (FrogAnimBP.Class != NULL)
	{
		GetMesh()->SetAnimInstanceClass(FrogAnimBP.Class);
	}
1 Like