Blured texture of custom mesh

Hi all!

When I create a mesh with the MeshFilter, The triangles look fine, but the texture is blured, doesn’t really look like it should.
I inspected the created mesh, the correct material is assigned.
I tried just to use the original prefab’s texture, and even assign a new texture to the MeshRenderer (from code and from Editor in runtime as well), but the results are the same.

One weird thing is, when I debug the code and inspect the mesh object, its uv array is empty, even after I assigned a valid array to it.

public void drawMesh(Vector3[] vertices
					, int[] indices
					, Vector2[] uvs
					, Texture2D tex
					, GameObject obj)
{
	
    Mesh mesh = new Mesh();
    obj.GetComponent<MeshFilter>().mesh = mesh;
	
	mesh.Clear();
	obj.GetComponent<MeshRenderer>().material.mainTexture=tex;
	mesh.vertices = vertices;
	mesh.triangles = indices; 
	mesh.uv=uvs;
	
	mesh.RecalculateNormals();
	mesh.RecalculateBounds();
	mesh.Optimize();
}

These are the indices and UVs:

int[] indices = new int[]{
				  0, 1, 2
				, 2, 1, 3};
	
	Vector2 uv0 = new Vector2(0,0);
	Vector2 uv1 = new Vector2(1,0);
	Vector2 uv2 = new Vector2(0,1);
	Vector2 uv3 = new Vector2(1,1);
		
	Vector2[] uvs = new Vector2[]{
		  uv2, uv3, uv0
		, uv0, uv3, uv1
	};

A picture about this:

http://kepfeltoltes.hu/120507/asphalt_incorrect_texture_www.kepfeltoltes.hu_.png

Any help appreciated!

It looks like you have 4 verts (you assign tris using verts 0-3,) but have 6 uv coordinates. Should only have 4 (one per vert.)