How can I create procedural mesh with dynamic resolution?

I would like to create a plane with dynamic resolution using UProceduralMeshComponent. I was following this video

And I tried to rewrite his code in UE.
This is my code.

void ATerrainFace::init(int Resolution, FVector* LocalUp)
{
	myLocalUp = LocalUp;
	myResolution = Resolution;
	myAxisA = new FVector(myLocalUp->Z, myLocalUp->X, myLocalUp->Y);
	myAxisB = FVector::CrossProduct(*myLocalUp,*myAxisA);
}


void ATerrainFace::constructMesh()
{
	TArray<FVector> vertices; 
	TArray<int32> triangles;
	FVector2D* percent;
	FVector pointOnUnitCube;
	for (int y=0; y<myResolution; y++)
	{
		for (int x=0; x<myResolution; x++)
		{
			int i = x + y * myResolution;
			percent = new FVector2D(x/(myResolution-1), y/ (myResolution - 1));
			pointOnUnitCube = (*myLocalUp+(percent->X - .5f) * 2 * (*myAxisA)+(percent->Y - .5f) * 2 * myAxisB);
			vertices.Add(pointOnUnitCube*myScale);

			if (x!=myResolution-1 && y!= myResolution -1)
			{
				triangles.Add(i);
				triangles.Add(i + myResolution);
				triangles.Add(i + myResolution + 1);
				
				triangles.Add(i);
				triangles.Add(i + myResolution + 1);
				triangles.Add(i + 1);
			}
		}
	}
	
	
	TArray<FLinearColor> VertexColors;
	VertexColors.Add(FLinearColor(0.f, 0.f, 0.f));
	myMesh->CreateMeshSection_LinearColor(0, vertices, triangles,TArray<FVector>(), TArray<FVector2D>(), VertexColors, TArray<FProcMeshTangent>(), false);
}

It compiles and runs without any problem but the plane I get consists of 4 vertices and 2 triangles instead of myResolution*myResolution vertices. Can anyone explain why, what am I have done wrong or is it not possible ? Thank you in advance.