Well, if you have heightmap samples you could simply use Unity’s Terrain engine. However it expects the height values to be float values in the range 0 - 1

Though if you want to create a mesh you just do something like this:

Vector3[] vertices = new Vector3[65*65];
for (int i = 0; i < vertices.Length; i++)
{
vertices _= new Vector3(i %65, arrayValues*, i / 65);*_

} mesh.vertices = vertices; Note the i%65 and i/65 are basically the x and z values of your grid. You may want to scale your arrayValues as “139” would be huge in usual world units. Once you have created and assigned your vertices you have to actually define the triangles between the vertices by creating a triangle list: int[] triangles = new int[64646]; // note we only have 6464 quads between 6565 vertices int n = 0; for(int y = 0; y < 64; y++) { int yOff = y * 65; for(int x = 0; x <64; x++) { triangles[n++] = yOff + x; triangles[n++] = yOff + x + 65; triangles[n++] = yOff + x + 65 + 1;

triangles[n++] = yOff + x; triangles[n++] = yOff + x + 65 + 1; triangles[n++] = yOff + x + 1; } } mesh.triangles = triangles; mesh.RecalculateNormals(); mesh.RecalculateBounds(); Note that the resulting mesh won’t have any UV texture coordinates. If you want to texture map the mesh you have to create UV coordinates as well Vector2[] uvs = new Vector2[vertices.Length];

for(int i = 0; i < uvs.Length; i++) { uvs = new Vector2(i%65, i/65) / 64f; } mesh.uv = uvs;