Hi everyone,
I’m trying to implement a class where i handle the mesh creation of a triangle.
I’ve a question about the vertices update of my mesh, i don’t understand why i need to initialize the vertex array instead of change the value of each vertex.
// -------------- WORK--------------
mesh.vertices = new Vector3[] { new Vector3(0, 0, 0 )+ position,
( new Vector3(0, 1 * scale.y, 0) + position ) ,
( new Vector3(1 * scale.x, 1, 0) + position)
};
//------------------------------------------------//
// -------------- Doesn't work --------------
mesh.vertices[0] = new Vector3(0, 0, 0) + position;
mesh.vertices[1] = new Vector3(0, 1 * scale.y, 0) + position;
mesh.vertices[2] = new Vector3(1 * scale.x, 1, 0) + position;
//------------------------------------------------//