Procedurally set EditAnywhere (UPROPERTY)

> please also see related forum post

How do I set a dynamically spawned Component/Actor to EditAnywhere if I cannot use the UPROPERTY() macro, since this is purely runtime based from c++.

I want to spawn a child actor via UChildActorComponent, which works to some extent. But the spawned child actor is not editable or selectable in the World Outliner or Editor Viewport. But setting a UPROPERTY() macro is not possible since the actor and UChildActorComponents are spawned at runtime and I do not have class attribute where I could put the UPROPERTY() macro. So I need to be able to set an Actor/Component to EditAnywhere purely from C++ at runtime. How do I do this=

UChildActorComponent* NewComp1 = NewObject<UChildActorComponent>(this);
NewComp1->bEditableWhenInherited = true;

Related, but not answered / working:
“> How to add UPROPERTY dynamically?”

It’s not practical because you will need to add property to UClass and this will alter class information and all objects on the level of that class, possibly permanently since UClass don’t reset with the world… and i don’t see reason why you would want to have it in first place, there easier way to do this:

Just make

UPROPERTY(EditInstanceOnly, Instanced)
AMyChildActor* ChildActor;

EditInstanceOnly will make it visible only in level property editor and Instanced will make actor properties editable. And then after NewComp1->CreateChildActor(); do this:

ChildActor = NewComp1->GetChildActor();