Dynamically adding child components in Editor

Thanks for reply. That seems to be working, but if I am not sure how to properly attach components together.

In header file (WallComponent.h) I create property



UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = Test)
UInstancedStaticMeshComponent* _instances;


and in constructor:



auto name = this->GetName();
name += FString("-wall");

_instances = CreateDefaultSubobject<UInstancedStaticMeshComponent>(*name);
_instances->SetupAttachment(this);


After adding component Wall to Actor in editor I can see that InstancedStaticMeshComponent was attached to Actor and I can edit it using blueprints.
BUT in Details window of attached Wall, there is editable property **Instances **(of type InstancedStaticMeshComponent), which seems to be different one than the attached component.

Any idea what might be cause?

I am afraid this might lead to memory leaks.