Does anyone have a solution for this? Here’s a bit of code that might stimulate some ideas:
I’m creating 6 quads to form a cube. Here is how I create one quad:
// Arrays declared in header
TArray<FVector> vertices;
TArray<int32> triangles;
TArray<FVector> normals;
TArray<FVector2D> UVs;
TArray<FProcMeshTangent> tangents;
TArray<FLinearColor> vertexColors;
// Creating the quad by ordering vertices in the array
parent->vertices.Add(points[1] + position);
parent->vertices.Add(points[5] + position);
parent->vertices.Add(points[6] + position);
parent->vertices.Add(points[2] + position);
// normals
parent->normals.Add(FVector(0.0f, 0.0f, -1.0f));
parent->normals.Add(FVector(0.0f, 0.0f, -1.0f));
parent->normals.Add(FVector(0.0f, 0.0f, -1.0f));
parent->normals.Add(FVector(0.0f, 0.0f, -1.0f));
// triangles
parent->triangles.Add(parent->vertices.Num() - 4);
parent->triangles.Add(parent->vertices.Num() - 3);
parent->triangles.Add(parent->vertices.Num() - 2);
parent->triangles.Add(parent->vertices.Num() - 2);
parent->triangles.Add(parent->vertices.Num() - 1);
parent->triangles.Add(parent->vertices.Num() - 4);
// I then create the mesh, set the material and enable collisions
// mesh is a UProceduralMeshComponent
mesh->SetMaterial(0, material);
mesh->CreateMeshSection_LinearColor(0, vertices, triangles, normals, UVs, vertexColors, tangents, true);
mesh->ContainsPhysicsTriMeshData(true);
The above code generates my cube and applies my UV targeted texture to each face. I just can’t get the color of one face to change.
I have experimented with different values within the vertexColors array, but nothing I have tried makes any difference. In the above example I am passing in empty arrays.
Any ideas?