Procedurally generated mesh is invisible.

First of all, it has a MeshRenderer, so that´s not the problem. The vertices of the mesh go from left to right per row, from below to above in a grid. The order of triangles was clockwise, so I simpy don´t know what´s wrong. Here´s my code:

Mesh mesh;

Vector3[] orderedVertices;
int[] orderedTriangles;

void Start()
{
    mesh = new Mesh();

    GetComponent<MeshFilter>().mesh = mesh;

    CreateShape();
    UpdateMesh();
}

void CreateShape()
{
    List<float> rows = new List<float>(); 
    List<float> columns = new List<float>();

    //Here am skipping code that gets the values of the rows (z coordinates of vertices) and columns (x coordinates). Am using Contains() to avoid repetition. This is is fine: I already checked.

    rows.Sort();
    columns.Sort();

    orderedVertices = new Vector3 [rows.Count * columns.Count];

    for (int i = 0, r = 0; r < rows.Count; r++) 
    {
        for (int c = 0; c < columns.Count; c++, i++) 
        {
            orderedVertices *= Vector3.zero;*

orderedVertices*.z = rows[r];*
orderedVertices*.x = columns*
```c
;
orderedVertices
.y = bottomFormer.y; //the order is fine as well.
}
}

    int xSize = rows.Count - 1; //number of squares per row
    int zSize = columns.Count - 1;

    orderedTriangles = new int[(xSize * zSize) * 6]; 

    //I originally had code here to set the triangles, but it didn´t worked and I moved on to something more simple... that still doesn´t work:
   
    orderedTriangles[0] = 0;
    orderedTriangles[1] = columns.Count; //clockwise order
    orderedTriangles[2] = 1;

    orderedTriangles[3] = 1;
    orderedTriangles[4] = columns.Count;
    orderedTriangles[5] = 1 + columns.Count;
}

void UpdateMesh()
{
    mesh.Clear();

    mesh.vertices = orderedVertices;
    mesh.triangles = orderedTriangles;
    
    for (int i = 0; i < mesh.triangles.Length; i++)
    {
        Vector3 vert = mesh.vertices[mesh.triangles*];
        print("error vertex[triangles]: " + vert.x + ", " + vert.y + ", " + vert.z);   //this seems to be fine. Is the supposed order and all of the vertices are in their respective places
    }

    mesh.RecalculateNormals();
    //mesh.RecalculateBounds(); I didn´t knew if it was this, but nothing.
}

At least that I know, am doing everything right, but the mesh is still invisible.

Thanks for your help and time.
_```*_

Well, it probably is just this line:

GetComponent<MeshFilter>().mesh = mesh;

try this one instead:

GetComponent<MeshFilter>().sharedMesh = mesh;

The “mesh” property will ensure that this MeshFilter has it’s own instance of the mesh. So since you modify the mesh after you assigned it to your MeshFilter, the meshfilter will be stuck with a copied empty mesh.

Note that the vertex array creation could be simplified and optimised like that:
Vector3 v = new Vector3(0,bottomFormer.y,0);
for (int i = 0, r = 0; r < rows.Count; r++)
{
v.z = rows[r];
for (int c = 0; c < columns.Count; c++, i++)
{
v.x = columns

;               
            orderedVertices* = v;
        }
    }

Is this supposed to create some sort of table? Though it seems a bit strange that you sort the rows and columns like that.