📄 헤더
UPROPERTY(EditAnywhere, BlueprintReadOnly)
class USkeletalMeshComponent* gunMeshComp;
📄 소스
ATPSPlayer::ATPSPlayer()
{
gunMeshComp = CreateDefaultSubobject<USkeletalMeshComponent>(TEXT("gunMeshComp"));
gunMeshComp->SetupAttachment(GetMesh());
ConstructorHelpers::FObjectFinder<USkeletalMesh> tempGunMesh(TEXT("SkeletalMesh'/Game/Resources/FPWeapon/Mesh/SK_FPGun.SK_FPGun'"));
if (tempGunMesh.Succeeded())
{
gunMeshComp->SetSkeletalMesh(tempGunMesh.Object);
gunMeshComp->SetRelativeLocation(FVector(0, 40, 140));
}
}