Generated Mesh Triangles not Being Made/Visible?

I wrote code for generating a mesh at specific coordinates as such:

FixedUpdate(){

//Lots of code that tracks mouse position 

if (Input.GetMouseButtonDown (0)) {
			createTileMesh (listIndex); 
		}


}

void createTileMesh(int tileIndex){
		Mesh tileMesh = new Mesh ();
		MeshFilter tileFilter; 
		MeshRenderer tileRender;

		Vector3 debugTileCentre; 
		Vector3[] vertices = new Vector3[4]; 
		int[] triangles = new int[6];
		Vector3[] normals = new Vector3[4];  

		vertices = tileList [listIndex].VERTICES; 
		debugTileCentre = tileList [listIndex].TILECENTRE; 
		Debug.Log (tileIndex); 

		Debug.Log (debugTileCentre); 

		vertices [0].y = vertices [0].y + 1f;
		vertices [1].y = vertices [1].y + 1f;
		vertices [2].y = vertices [2].y + 1f;
		vertices [3].y = vertices [3].y + 1f;

		Debug.Log (vertices [0]); 
		Debug.Log (vertices [1]);
		Debug.Log (vertices [2]);
		Debug.Log (vertices [3]);

		triangles[0] = 0; 
		triangles[1] = 2;
		triangles[2] = 1;

		triangles[3] = 1;
		triangles[4] = 3;
		triangles[5] = 2;

		normals [0] = Vector3.up; 
		normals [1] = Vector3.up; 
		normals [2] = Vector3.up; 
		normals [3] = Vector3.up; 




		tileMesh.vertices = vertices; 
		tileMesh.normals = normals; 
		tileMesh.triangles = triangles; 
		 

		tileMesh = GetComponent<MeshFilter> ().mesh;  
		tileRender = GetComponent<MeshRenderer> (); 
		MeshCollider mesh_collider = GetComponent<MeshCollider>();
		 
		
		//tileFilter = GetComponent<MeshFilter>().mesh; 

		 
		Debug.Log ("Done Mesh"); 




	}

For those of you wondering about the vertices array a sample output (I’ve tested with the debug log thing) would be something like:

//Sample values 
vertices[0] = (1.8, 1, -22.3) //Top left corner
vertices[1] = (1.8, 1, -23.8) //Top right corner
vertices[2] = (0.3, 1, -22.3) //Bottom left corner
vertices[3] = (0.3, 1, -23.8) //Bottom right corner 


Try as I might, no triangles in game view, or scene view from the bottom or top.

tileMesh = GetComponent ().mesh;

means that the tileMesh mesh, which you declared at the start at your method and to which you have assigned the created vertices, triangles and normals, gets overriden with the MeshFilter’s own mesh… So the method’s work is basically wasted :wink:
It has to be the other way around:

GetComponent<MeshFilter> ().mesh = tileMesh;