Child component spawning to world location

I have an actor component, and a mesh attached to it. When I create another component (ie, a text box, or a capsule component with a child mesh) my child component seems to always spawn to the world location (as in, the middle of the world, no matter where I place the actor).

From my understanding of things, and keep in mind I am still relatively new at Unreal, is that when you create a first object on the screen, it becomes the parent object, and any other objects are automatically attached to it. So is there perhaps a way to set “createdefaultsubobject” to automatically snap to its parent mesh, instead of jumping to the center of the map?

I could simply move each component by hand, but in the event that I need to spawn an actor on the fly, generally I can’t do that. Any help would be appreciated.

Thank you!

If I’m understanding you correctly, this is how you attach a component to a root component and it should create a child-parent relationship between them.

RootComponent = MyRootComponent;

ChildComponent->SetupAttachment(MyRootComponent);

This is how they do it in most of the example templates anyways and it works for me.

Hi, sorry it took so long to reply to you! I thought that it didn’t work, but I was going over some other code and realized that I hadn’t created a new object, but was using old ones. Thanks so much for your help, it worked!