Attach an actor to an other actor

Hello,

Please, could you tell me how to attach an Actor to an other Actor in C++.
For the moment, I create my actor like that:

AActor* A = World->SpawnActor<AActor>(c);
A->SetActorLocation(position);
A->SetOwner(this->GetOwner());

I’ve tested several solutions but the new actor which have been created is never in the hierarchy of the “root” actor.

Thank you in advance.

You would use the “AttachTo(…)” command,

    Actor->AttachTo(Mesh, AttachPoint, EAttachLocation::SnapToTarget);
...or...
    Actor->AttachTo(Parent);

A couple examples.
Hope that helps =)

Thank you but AActor has not the “AttachTo(…)” command :confused:

Thank you very much!!!

Here you go :slight_smile:

pActor->AttachRootComponentToActor(Parent)