Download

Loading UBlueprint or Baseclass in Constructor

Currently I am loading weapons in the constructor using USkeletalMeshComponent’s. But I would like to change it to UBlueprint or prehaps the baseclass itself using FClassFinder/FObjectFinder. Unfortunately I am unable to get the object to display. Can someone provide a link or code that shows how that is done?

static ConstructorHelpers::FObjectFinder<USkeletalMesh> WeaponSkeletalMesh(*WeaponName);
if (WeaponSkeletalMesh.Succeeded())
{
	USkeletalMeshComponent* meshComp = CreateDefaultSubobject<USkeletalMeshComponent>(ARvBCharacter::RightWeaponName);

	meshComp->SetRelativeRotation(RightRotation);
	meshComp->SetRelativeLocation(RightLocation);
	meshComp->SetRelativeScale3D(RightScale);

	meshComp->SetSkeletalMeshWithoutResettingAnimation(WeaponSkeletalMesh.Object);
	//meshComp->SetupAttachment(GetMesh(), ARvBCharacter::RightSocketName);
	meshComp->AttachToComponent(GetMesh(), FAttachmentTransformRules(EAttachmentRule::SnapToTarget, true), ARvBCharacter::RightSocketName);
}