Procedural array of meshes problem / solved

Hi guys! Here is my attempt to generate and render an array(list) of simple rectangle meshes. List contains 100 items but Unity renders the only one (i suppose that the problem is because of incorrect using of MeshFilter but im not sure). Also i tried to make simple color changing with OnMouseOver() and here is also fail.
Any suggestions?
Thanks in advance for help!

*on a screenshot the cube is only measure tool.

the code:

using UnityEngine;
using System.Collections;
using System.Collections.Generic;

public class test_cuba : MonoBehaviour {
		List <Mesh> shtuchki = new List<Mesh>();

	void Start () {		
		for(int n= 0; n < 10; n++){
			for (int m=0; m<10; m++){
				MeshFilter mfilter = gameObject.GetComponent<MeshFilter>();
				Mesh messh = new Mesh();
				mfilter.sharedMesh = messh;
				Rect rt = new Rect (n,m,1,1);
				/*Debug.Log ( rt.x);
				Debug.Log (rt.y);*/

				messh.vertices = new Vector3 [] {
					new Vector3(rt.x,rt.y,0), // ver0
					new Vector3(rt.xMax,rt.y,0), // ver1
					new Vector3(rt.xMax,rt.yMax,0), 	// ver2		
					new Vector3(rt.x,rt.yMax,0), //ver3
				messh.triangles = new int [] {
				renderer.material.color = Color.white;
				Debug.Log("mesh_number: " + shtuchki.Count); 
	void Update () {
		for(int v=0; v<shtuchki.Count; v++){
			Graphics.DrawMeshNow(shtuchki[v],, Quaternion.identity, 0);
	void OnMouseOver() {
        renderer.material.color =;

ZIP project:

You’re writing over the same mesh at each loop iteration, so the only mesh you see is the last one. You can either append all the triangles in a single mesh (but you won’t be able to change the color of a single one, not easily at least), or as Kerbo says, create a game object with it’s own meshFilter for each triangle.

Don’t forget to add a mesh collider, or the OnMouseXXX won’t work (they use raycasts)