Component doesn't appear in editor details panel

Hi there,

I have been trying to create a component inside the PostEditChangeProperty for a Spawner I’m making.
The problem is that I just create it as normal

UMyBoxComponent* Comp = NewObject<UMyBoxComponent>(this, UMyBoxComponent::StaticClass(), TEXT("BOX_COMPONENT"));
	Comp->bEditableWhenInherited = true;
	Comp->SetHiddenInGame(false);
	Comp->SetupAttachment(RootComponent);
	Comp->RegisterComponent();

For some reason the details panel doesn’t show the component even though I am 100% sure is created. (I have printed the child actors of RootComponent).

Need Help from anyone who have been through the same issue.

Note: A friend told me that my code works in other versions like 4.19, but I need this to be working on 4.21.

is there a specific reason that you have to create the component in the PostEditChangeProperty and not in the constructor?

Hello, sorry for the late response.
Yes, I want to create a tool for the game designers that allows them to select the number of boxes that will be created, all of this works in the details panel.
In this panel they have an int variable which should let them see this 3 boxes created as childs of RootComponent and of course allow them to move and use them on the map.

Any clue would be so well received.

Would it be simpler just to ask the designers to use the ‘AddComponent’ menu rather than trying to build this into PostEditChangeProperty. I can see what you’re working towards but you might end up with more issues as a result of this (in terms of managing the boxes and not adding / removing in error)