Texture on mesh blurred

(Translation with google, I’m french).

I am beginning with unity, and after an attempt to create a map composed of a large number of tiles, using sprites, I understood that using meshes would be a better solution. so I start studying things that have never address the 3d closely. the unity tutorials are all very clear and I soon was successful display a mesh plane without texture. Then I create a texture composed of random pixels of color, to test, but when I apply it to my mesh, here is the result:

but the texture looks like this once save:


I guess it’s a expansion since my texture is 8x8 pixels, and my 8x8 mesh made in unity unity …

my goal is to create a texture where each pixel would be a tile in order to Modify the color of pixels (and therefore the tiles) when I want.

here’s my script, just to test:

using UnityEngine;
using System.Collections;
using System.IO;

public class Calque : MonoBehaviour {

    public Vector2 taille;

    private Mesh meshe;
    private Material material;
    private Texture2D texture;

    private void Awake()

    private void Generate()
        GetComponent<MeshFilter>().mesh = meshe = new Mesh();
        meshe.name = "Parcelle";

        Vector3[] vertices = new Vector3[6];
        Vector2[] uv = new Vector2[6];
        int[] triangles = new int[6];

        vertices[0] = new Vector3(0, 0);
        vertices[1] = new Vector3(taille.x, 0);
        vertices[2] = new Vector3(0, taille.y);
        vertices[3] = vertices[1];
        vertices[4] = new Vector3(taille.x, taille.y);
        vertices[5] = vertices[2];

        uv[0] = new Vector2(0, 0);
        uv[1] = new Vector2(1, 0);
        uv[2] = new Vector2(0, 1);
        uv[3] = uv[1];
        uv[4] = new Vector2(1, 1);
        uv[5] = uv[2];

        for(int a = 0; a < 6; ++a)
        { triangles[a] = a; }

        meshe.vertices = vertices;
        meshe.uv = uv;
        meshe.triangles = triangles;

        MeshRenderer meshRend = GetComponent<MeshRenderer>();
        meshRend.material = material = new Material(Shader.Find("Sprites/Default"));

        texture = new Texture2D(8, 8, TextureFormat.RGB24, false);
        material.SetTexture("_MainTex", texture);

        for (int x = 0; x < texture.width; x++)
            for (int y = 0; y < texture.height; y++)
                //texture.SetPixel(x, y, new Color(Random.value, Random.value, Random.value));
                texture.SetPixel(x, y, Random.Range(0, 2) == 0 ? Color.red : Color.blue);
        texture.SetPixel(0, 0, Random.Range(0, 2) == 0 ? Color.red : Color.blue);

        // Encode texture into PNG
        byte[] bytes = texture.EncodeToPNG();

        // For testing purposes, also write to a file in the project folder
         File.WriteAllBytes(Application.dataPath + "/../SavedScreen.png", bytes);

is there an option that I must unable?
Thank you for your help and your advice.

I found the solution, I searched for a long time, and finally:

texture.filterMode = FilterMode.Point;

So it had the texture.

new result: