Component not showing up in PIE mode

Hello. I construct a UStaticMesh component programmatically inside my component and attach it to mine; it shows up right away. However, when I go to PIE mode inside the editor, it does not show up. If i click on any of the component settings in details panel while in PIE mode, it magically shows up and stays visible.

Regarding my slave static mesh component I do just this:

UStaticMeshComponent* StaticMeshComponent = ConstructObject<UStaticMeshComponent>(UStaticMeshComponent::StaticClass(), GetOwner(), NAME_None, RF_Transient);

StaticMeshComponent->AttachTo(this);
StaticMeshComponent->RegisterComponent();
StaticMeshComponent->SetStaticMesh(StaticMesh);
StaticMeshComponent->SetVisibility(true);
StaticMeshComponent->SetRelativeTransform(FTransform(TransformMatrix));

Any ideas why this is happening?

If anyone is interested, this issue was related to components (newly created components from serialization just for PIE mode) not having their render state created. There’s probably a better way, but detecting PIE mode in OnRegister and manually calling RecreateRenderState_Concurrent solved the problem. Thanks.

could you expand a bit how you solved that?