Setting Mesh objects in C# only renders Triangles

I am trying to render mesh objects from a C# script. For some reason when I set mesh.verticies to have 4 or more verticies, and mesh.triangles to have a multiple of 3 indices I only get the result of a triangle.

Also, this is a project set up for 2D.

I have an object in my Unity hierarchy that has the following components: Mesh Renderer, Mesh Filter, Polygon Collider 2D.

Here is the code that I am using

GameObject.Find("Building Object").GetComponent<MeshFilter>().mesh.vertices = new Vector3[] {new Vector3(26, -44, 0), new Vector3(34, -74, 0), new Vector3(54, -68, 0), new Vector3(45, -39, 0), new Vector3(26, -44, 0), new Vector3(26, 44, 0)};
GameObject.Find("Building Object").GetComponent<MeshFilter>().mesh.triangles = new int[] {0, 1, 2, 3, 4, 5};

I have found that if I change mesh.triangles to be {0, 1, 2} I get a different triangle. I assume that this means that I am taking the first, second and third verticies from mesh.verticies.

Thank you in advance.

Triangles is an int.Every three values is a triangle.Each value is the index of a vertex on the vertices array. So in @rutters’ example vertices with index 0,1,2 is one triangle and vertices with index 3,4,5 is the other.Unfortunately I don’t know the mesh you are trying to render so I can’t tell you which triangles to make.