> 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; NewComp1->RegisterComponent(); NewComp1->SetChildActorClass(AMyChildActor::StaticClass()); NewComp1->CreateChildActor();
Related, but not answered / working:
“> How to add UPROPERTY dynamically?”