Spawn mesh @designtime outside constructor

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);
	}

Hi Napoleon

Just wondering if you got a solution to this yet. I’m faced with the same problem.

Cheers.

I have one question, do you have this in a seperate function that you can call? Also I would suggest looking at this: LINK this might be the solution your looking for or at least some sort of direction for you.