How to attach an actor to an another actor?

Hello, I am following the C++ programming tutorial and I am trying to learn how to attach an actor to another actor by using components. I have tried a few things but I didn’t managed.

I have created an UActorComponent in my pawn class, and I though, with this way, I can attach another actor to my pawn. But later I have figured out this didn’t work.

How can I attach my actor, for example one created with C++ and has special “abilities”, to my pawn or actor?

You can use something like MyActor->AttachRootComponentToActor(ParentActor). You can also check this documenation for some more info about that function.

Hope this helps :slight_smile:

2 Likes

Thanks for help! For this one I am going to have to spawn a new actor. I am going to look at it.