I am trying to control the editor from a plugin. I would like to create an actor and add a static mesh to it, in C++. (At this time, I do not want to make my own AActor subclass, I want to learn to control the editor).
I have tried the following, and expected to see a new actor with a static mesh.
auto actor = world->SpawnActor(AActor::StaticClass()); auto meshcomponent = NewObject<UStaticMeshComponent>(actor, UStaticMeshComponent::StaticClass()); meshcomponent->OnComponentCreated(); meshcomponent->RegisterComponent();
However, what actually see is a new Actor in the World Outliner, but no Transform section in Details, or Static Mesh Component in the hierarchy.
How can I see the changes to the hierarchy reflected in the editor?