I am creating multiple default sub objects then attaching the mesh to the main character mesh. Nothing bad happens during runtime and even when I run a function checking to see if the mesh is null the function runs.(Meaning the skeletal mesh is not null but it seems like it is not null only during runtume.)
ACharacter::ACharacter()
{
PrimaryActorTick.bCanEverTick = true;
Health = 150;
EnemyWeaponBaseMesh = CreateDefaultSubobject<USkeletalMeshComponent>(TEXT("WeaponBaseMesh"));
EnemyWeaponBaseMesh->AttachToComponent(SkeletonRightArmJill, FAttachmentTransformRules::SnapToTargetIncludingScale, FName("EnemyWeaponBase"));
//Here it triggers a breakpoint.
SkeletonHead = CreateDefaultSubobject<USkeletalMeshComponent>(TEXT("HeadSkeleton"));
SkeletonLeftArm = CreateDefaultSubobject<USkeletalMeshComponent>(TEXT("MilitantLeftArmSkeleton"));
SkeletonRightArm = CreateDefaultSubobject<USkeletalMeshComponent>(TEXT("MilitantRightArmSkeleton"));
SkeletonTorso = CreateDefaultSubobject<USkeletalMeshComponent>(TEXT("MilitantTorsoSkeleton"));
SkeletonRightLeg = CreateDefaultSubobject<USkeletalMeshComponent>(TEXT("MilitantRightLegSkeleton"));
SkeletonLeftLeg = CreateDefaultSubobject<USkeletalMeshComponent>(TEXT("MilitantLeftLegSkeleton"));
EnemyWeaponBaseMesh->SetupAttachment(GetMesh());
SkeletonHead->SetupAttachment(GetMesh());
SkeletonTorso->SetupAttachment(GetMesh());
SkeletonLeftArm->SetupAttachment(GetMesh());
SkeletonRightArm->SetupAttachment(GetMesh());
SkeletonRightLeg->SetupAttachment(GetMesh());
SkeletonLeftLeg>SetupAttachment(GetMesh());
}
void ACharacter::SetMasterPoseComponent()
{
SkeletonHead->SetMasterPoseComponent(GetMesh());
SkeletonLeftArm->SetMasterPoseComponent(GetMesh());
SkeletonRightArm->SetMasterPoseComponent(GetMesh());
SkeletonTorso->SetMasterPoseComponent(GetMesh());
SkeletonLeftLeg->SetMasterPoseComponent(GetMesh());
SkeletonRightLeg->SetMasterPoseComponent(GetMesh());
EnemyWeaponBaseMesh->SetMasterPoseComponent(GetMesh());
}