Skip to content

Commit dd8705a

Browse files
committed
2 parents ed94430 + 7c7a1cc commit dd8705a

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

Source/PrefabricatorRuntime/Private/Prefab/PrefabTools.cpp

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -706,13 +706,15 @@ namespace {
706706
const bool bIgnoreBounds = InActor->IsA<APrefabActor>() || IgnoreActorClasses.Contains(InActor->GetClass());
707707
if (!bIgnoreBounds) {
708708
FBox ActorBounds(ForceInit);
709-
InActor->ForEachComponent<UPrimitiveComponent>(false, [&ActorBounds, &bNonColliding, &IgnoreActorClasses](const UPrimitiveComponent* InPrimComp) {
710-
if (!IgnoreActorClasses.Contains(InPrimComp->GetClass())) {
711-
if (InPrimComp->IsRegistered() && (bNonColliding || InPrimComp->IsCollisionEnabled())) {
712-
ActorBounds += InPrimComp->Bounds.GetBox();
713-
}
709+
for (const UActorComponent* ActorComponent : InActor->GetComponents()) {
710+
if (const UPrimitiveComponent* InPrimComp = Cast<UPrimitiveComponent>(ActorComponent)) {
711+
if (!IgnoreActorClasses.Contains(InPrimComp->GetClass())) {
712+
if (InPrimComp->IsRegistered() && (bNonColliding || InPrimComp->IsCollisionEnabled())) {
713+
ActorBounds += InPrimComp->Bounds.GetBox();
714+
}
715+
}
714716
}
715-
});
717+
}
716718

717719
if (ActorBounds.GetExtent() == FVector::ZeroVector) {
718720
ActorBounds = FBox({ InActor->GetActorLocation() });

0 commit comments

Comments
 (0)