Mesh.uv Manual     Reference     Scripting  
Scripting > Runtime Classes > Mesh
Mesh.uv

var uv : Vector2[]

Description

The base texture coordinates of the mesh.

// Generate planar uv coordinates
function Start () {
var mesh : Mesh = GetComponent(MeshFilter).mesh;
var vertices = mesh.vertices;
var uvs = new Vector2[vertices.length];

for (var i=0;i<uvs.Length;i++) {
uvs[i] = Vector2 (vertices[i].x, vertices[i].z);
}
mesh.uv = uvs;
}