MeshComps = NewObject<USkeletalMeshComponent>(this, NAME_None, RF_NoFlags, GetMesh()); MeshComps->SetAnimInstanceClass(nullptr); MeshComps->SetCollisionEnabled(ECollisionEnabled::NoCollision); MeshComps->AttachToComponent(GetMesh(),FAttachmentTransformRules::SnapToTargetIncludingScale); MeshCompsSetMasterPoseComponent(GetMesh());//和主mesh共用一套骨骼,如果不需要那么不需要设置这个方法 MeshComps->RegisterComponentWithWorld(GetWorld());