I have the following code in an Actor subclass. I’m trying to make a procedural mesh and color it with the vertex colors. The mesh is added to the world ok but it remains the default gray, there is no hint of red at all.
UProceduralMeshComponent *PMesh = CreateDefaultSubobject<UProceduralMeshComponent>(TEXT("MyProceduralMesh"));
TArray<FVector> verts;
TArray<int32> tris;
verts.Add(FVector(0,0,0)); // 0
verts.Add(FVector(0,300,0)); // 1
verts.Add(FVector(300,300,0));// 2
verts.Add(FVector(300,0,0)); // 3
tris.Add(0);
tris.Add(1);
tris.Add(2);
tris.Add(0);
tris.Add(2);
tris.Add(3);
TArray<FColor> colors;
for (int i=0; i<4; i++) {
colors.Add(FColor(255, 0, 0));
}
PMesh->CreateMeshSection(0, verts, tris, TArray<FVector>(), TArray<FVector2D>(), colors, TArray<FProcMeshTangent>(), true);
SetRootComponent(PMesh);