I try to construct my character by C++ code. In a constructor of my class derived from ACharacter I wrote this code:
ConstructorHelpers::FObjectFinder<USkeletalMesh> New_Mesh(
TEXT("SkeletalMesh'/Game/AnimStarterPack/UE4_Mannequin/Mesh/SK_Mannequin.SK_Mannequin'"));
GetMesh()->SetSkeletalMesh(New_Mesh.Object);
ConstructorHelpers::FObjectFinder<UAnimBlueprintGeneratedClass> BP_Anim(
TEXT("AnimBlueprint'/Game/AnimStarterPack/UE4ASP_HeroTPP_AnimBlueprint.UE4ASP_HeroTPP_AnimBlueprint'"));
GetMesh()->SetAnimInstanceClass(BP_Anim.Object);
The first part of the code works as expected: it successfully find a skeletal mesh and then set it for my character. But the second part can’t find an animation blueprint. Both paths (to the mesh and to the BP) are got from the UE4 editor and are correct. (In the editor I can set this BP to my character successfully, but I need to set it at runtime by C++ code).