The code below does not work. Some weird message about a conversion problem and “loses qualifiers”.
When I remove the if (SkeletalMeshObj.Succeeded()) check it will work. Also if I only remove the “const” keyword it will work. For some reason .succeeded() does not work with a const. Why?
const ConstructorHelpers::FObjectFinder<USkeletalMesh> SkeletalMeshObj(TEXT("/Game/AnimationAssets/UE4_Mannequin/Mesh/SK_Mannequin"));
if (SkeletalMeshObj.Succeeded()) // remove const-keyword in the above line and this will no longer crash.
{
GetMesh()->SetSkeletalMesh(SkeletalMeshObj.Object);
GetMesh()->SetRelativeLocation(FVector(0.0f, 0.0f, -90.0f));
GetMesh()->SetRelativeRotation(FRotator(0.0f, -90.0f, 0.0f));
}
else
{
}