把Actor绑定到角色的插槽上

void AMonster::PostInitializeComponents()
{
Super::PostInitializeComponents();
// instantiate the melee weapon if a bp was selected
if( BPMeleeWeapon )
{
MeleeWeapon = GetWorld()->SpawnActor<AMeleeWeapon>(
BPMeleeWeapon, FVector(), FRotator() );
if( MeleeWeapon )
{
const USkeletalMeshSocket *socket = Mesh->GetSocketByName(
"RightHandSocket" ); // be sure to use correct
// socket name!
socket->AttachActor( MeleeWeapon, Mesh );
}
}
}
The monst