I have a custom actor that I am trying to add to my level and for the life of me I’ve tried tons of examples and cannot get the mesh assigned to the Model that I created any help greatly appreciated.
void ANPCCharacter::AssignMeshAsset(FString MeshPath, FString OutInfoMessage)
{
static ConstructorHelpers::FObjectFinder<USkeletalMesh> mesh(MeshPath);
mesh->SetSkeletalMesh(mesh.Object);
FString::Printf(TEXT(OutInfoMessage), *MeshPath);
}
I also tried this approach:
ANPCCharacter::ANPCCharacter()
{
PrimaryActorTick.bCanEverTick = true;
SetRootComponent(CreateDefaultSubobject<USceneComponent>(TEXT("DefaultSceneRoot")));
Model->SetupAttachment(RootComponent);
FString meshPath = "TEXT(\"/Script/Engine.SkeletalMesh'/Game/Characters/UEFN_Mannequin/Meshes/SKM_UEFN_Mannequin.SKM_UEFN_Mannequin\")";
USkeletalMesh* FPersonaToolkit::GetMesh();
ACharacter* myCharacter = Cast<ACharacter>(GetOwner()); USkeletalMeshComponent* CharacterMesh = myCharacter->GetMesh(meshPath);
if (myCharacter) {
Model->
UE_LOG(LogTemp, Warning, TEXT("Mesh Lookup/Assign Succeeded!"), 0);
}
}
Just want to set the skeletal mesh asset for the form control so i can drag and drop default npc characters in that I can later change the model to a different one.