Gun not attached to character

Hi there -

After following the tutorial and compiling the code, the gun doesn’t appear in my BP_ShooterCharacter’s hands. In fact, it’s still outside appearing to move around as if in an idle animation.

I’ve attached screenshots, and my code.

void AShooterCharacter::BeginPlay()

	Gun = GetWorld()->SpawnActor<AGun>(GunClass);

	GetMesh()->HideBoneByName(TEXT("weapon_r"), EPhysBodyOp::PBO_None);

	Gun->AttachToComponent(GetMesh(), FAttachmentTransformRules::KeepRelativeTransform, TEXT("WeaponSocket"));


Any help is appreciated!

Edit: I fixed my issue. I’m unsure what exactly fixed it - I meticulously redid everything related to BP_Rifle and recompiled. Eventually it spawned into my character’s hands.

Privacy & Terms