Procedural Mesh (Create Mesh Section) not rendering?

Is anyone capable of explaining to me why my create mesh section is not working? if I use the “Make Array” blueprint for the Vertices than everything works. However, generating them in a script of with a blueprint for loop seems to make it not work. I manually checked that the vertices are correct in the debugger, so the information is there. It is also not related to the direction of the face as I checked both directions in the viewport. I expect it to be wrongly formatted.

TArray<FVector> UMyBlueprintFunctionLibrary::GetGlobalVertices(float EdgeLength)
{
	TArray<FVector> Vertices;
	for (int i = 0; i < 22; i++)
	{
		float posX = -(EdgeLength * 2.75f) + i * EdgeLength * 0.5f - floor((i + 1) / 4) * EdgeLength;
		float posY = cos(PI / 6) * 0.5f * EdgeLength - cos(PI / 6) * EdgeLength * i + cos(PI / 6) * 4 * EdgeLength * floor((i + 1) / 4);
		float posZ = 0;
		Vertices.Add(FVector(posX, posY, posZ));
	}
	return Vertices;
}

The problem was that I was running it in the Event Graph instead of the Contruction Script.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.