Unable to attach actor to actor

I am unable to attach one actor to another.

This is code that runs in my character when I press the key “I”.

This is the result in the world.

113908-comeon-2.png

As you can see, the actors spawn but dont get attached.

Have you tried setting the value of “AttachParent”? E.g.

Actor2->AttachParent = Actor2->RootComponent;

Hey -

The comment for AttachToActor in Actor.h says that it’s attaching the root component of the first actor to the root component of the second actor. The issue that you’re seeing is that AActor does not define its own root component. If you create a class based on Actor and define your own root component, then the AttachToActor function will have the expected behavior.

Cheers