I am still trying to understand voxel programming and just starting to understand it. Right now I have it so it generates a cube. I decided I would try to get it to generate a texture on the cube but looking at other peoples code I didn’t understand it enough to put it in the script. So if you could put it in and explain a little I would like that:).
This is the texture I am using for now

this is the script so far
var newVertices : Vector3[];
var newUV : Vector2[];
var newTriangles : int[];
var material : Texture2D;
function Start () {
var mesh : Mesh = new Mesh ();
GetComponent(MeshFilter).mesh = mesh;
mesh.Clear();
var p1 = Vector3(0,0,0);
var p2 = Vector3(1,0,0);
var p3 = Vector3(0,1,0);
var p4 = Vector3(0,0,1);
var p5 = Vector3(1,0,1);
var p6 = Vector3(1,1,0);
var p7 = Vector3(0,1,1);
var p8 = Vector3(1,1,1);
newVertices = new Array (p1,p2,p3,p4,p5,p6,p7,p8);
newTriangles = [0,2,1, 1,2,5, 3,0,1, 1,4,3, 0,3,2, 2,3,6, 1,5,4, 5,7,4, 6,3,4, 6,4,7, 6,5,2, 7,5,6];
mesh.vertices = newVertices;
mesh.triangles = newTriangles;
mesh.uv = newUV;
mesh.RecalculateNormals();
mesh.RecalculateBounds();
mesh.Optimize();
}
what this dose
