for (const FLyraEquipmentActorToSpawn& SpawnInfo : ActorsToSpawn)
{
AActor* NewActor = GetWorld()->SpawnActorDeferred(SpawnInfo.ActorToSpawn, FTransform::Identity, OwningPawn);
if (NewActor)
-
{*
-
NewActor->FinishSpawning(FTransform::Identity, /*bIsDefaultTransform=*/ true);*
-
NewActor->SetActorRelativeTransform(SpawnInfo.AttachTransform);*
-
NewActor->AttachToComponent(AttachTarget, FAttachmentTransformRules::KeepRelativeTransform, SpawnInfo.AttachSocket);*
-
SpawnedActors.Add(NewActor);*
-
}*
if the weapon have no mesh unreal will crash,that s why add if