I have a grid-actor that has cells. And when I change the rows/columns on my grid-actor I would like it to update it’s cells at design-time. Because it’s done through a property it must also be done outside of the constructor and most likely in the PostEditChangeProperty().
But how is this done? Is this even possible? I know that blueprints have the “AddStaticMeshComponent” node and it can be used outside of the constructor.
Code below crashes the editor:
// in for loop
UStaticMeshComponent* EditorMesh = CreateDefaultSubobject<UStaticMeshComponent>(TEXT("EditorMesh"));
EditorMesh->RegisterComponent();
EditorMesh->AttachTo(RootComponent);
ConstructorHelpers::FObjectFinder<UStaticMesh> PlaneMeshObj(TEXT("/Game/Meshes/Plane100x100"));
if (PlaneMeshObj.Succeeded())
{
EditorMesh->SetStaticMesh(PlaneMeshObj.Object);
}