This is very basic, but I have a hard time understanding being a C++ developer by trade.
Given the following code (apart from it’s uselessness in general)
void Start () {
MeshFilter temp;
temp = GetComponent(typeof(MeshFilter)) as MeshFilter;
Mesh themesh = temp.mesh;
Debug.Log("Verts : "+themesh.vertices.Length);
Vector3[ ] verts = themesh.vertices;
for (int i=0;i<24;i++)
verts*.z = 10;*
- themesh.vertices= verts;*
// for (int i=0;i<24;i++)
// themesh.vertices*.z = 10;*
* }*
Why do the commented out lines not work, whereas the assignment of the whole array does?
It must be some C# thing I don’t know about?
Is it because mesh.vertices returns a copy, but does implement an equals operator?
Any hints appreciated :o)
Kaj