I’m having some trouble setting the vertices of a mesh. Below is my code:
cubeMesh.vertices = new Vector3[12];
for (int vertexIndex = 0; vertexIndex < cubeMesh.vertices.Length; vertexIndex++)
cubeMesh.vertices[vertexIndex] = vertlist[vertexIndex];
Debug.Log(vertlist[vertexIndex]);
Debug.Log(cubeMesh.vertices[vertexIndex]);
}
When I run the code, the debugger outputs:
(1.0, 0.0, 0.7)
(0.0, 0.0, 0.0)
(0.3, 0.0, 0.3)
(0.0, 0.0, 0.0)
…
and so on. How could the adjacent lines be different if I’m setting the value of the mesh’s vertices to the value contained in the vertex list, and then immediately printing their values to the console? Help would be greatly appreciated.