After following and adding to the Procedural Mesh Generation Tutorial on the Wiki I have a procedurally generated Quad, that has UV’s and also has a Material assigned to it during Construction. I have added a UPROPERTY for a UMaterial (Now that shows up in the editor). Also in the constructor it is that very material that I load the material into, then “SetMaterial” on my mesh component with. My Class declaration looks like this:
UCLASS()
class AGeneratedFloorQuad : public AActor
{
GENERATED_UCLASS_BODY()
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = Materials)
UMaterial *GroundMaterial;
TSubobjectPtr<UGeneratedMeshComponent> mesh;
float HALF_SIZE = 500.f;
};
And in the constructor:
{
... left out vert crap
static ConstructorHelpers::FObjectFinder<UMaterial> mat(TEXT("/Game/Materials/Tri_Proj"));
GroundMaterial = mat.Object;
mesh->SetGeneratedMeshTriangles(triangles);
mesh->SetMaterial(0, GroundMaterial);
mesh->MarkRenderStateDirty();
RootComponent = mesh;
}
When I change the material in the editor it changes the material shown in the properties box, but not on the mesh component of the actor. How do I go about making it change the material on the mesh component of the actor?