4.9.2: Unreal-approved C++ method to create new child objects?

We took a Blueprint which loops through a SplineComponent’s points and adds StaticMeshComponents to the actor along those points and moved it into C++. Our C++ code, in an OnConstruction override, then mimicked the Blueprint: In a for-loop, we attempted numerous variations on the NewObject code block (creating, registering, etc), but in even the best case we only saw the final mesh appear.

Before we try and fix the last mesh appearing issue, I’d like to get Unreal’s suggested method of creating a child component in C++. The forums and answers seem to have a lot of people guessing and discussing the proper method, but I would rather not use the “magic” combination of creating and registering. We looked at the engine source to see what Create Static Mesh Component does, but that code seems to be heavily autogenerated and we couldn’t nail down where the actual creation takes place.

Is there an “Unreal approved” code block to create a child component?

For what it’s worth, you and me both SignalZak. I posted some of my struggles with this here, though it got no replies:

I finally found a magic incantation that appears to “work”, but like you I am not satisfied with such magic, and I can’t even explain why minor variations in the procedure or order of calls made the differences I encountered. From my local experimentation, it seems that the details might be different depending on the situation: are you in a constructor? A BeginPlay method? Different! Movement component vs primitive component, etc.