I have created a custom USceneComponent. This component has a mesh attached to it. In my pawn I need to dynamically create instances of this scene component attached to the RootComponent. I have attempted to do this using:
UCustomSceneComponent*Object= NewObject <UCustomSceneComponent>(this,UCustomSceneComponent::StaticClass());
Object->RegisterComponentWithWorld(this->GetWorld());
Object->SetWorldLocation(this->GetActorLocation());
Object->AttachTo(RootComponent);
The issue is that while I can see the scene component in the editor, the child mesh does not appear. If I try to add the scene component in a blueprint using the addComponent node, I can see the mesh. How can I replicate the functionality of this node in c++?