Altering verts doesn't seem to work on instantiated object.

I’m a Unity newb and hoping the wisdom out there could point me in the right direction. When I instantiate a prefab, it gets into the world fine, but when I try altering vert coords, nothing happens.

It finds the “default” GameObject fine and can get its mesh filter to access the verts, but changing the verts doesn’t seem to do anything.

What’s baffling to me, I can put similar code, directly into the same prevab I put into the world directly using the editor and it alters the verts as expected. Is there anything I need to do once something is instantiated to “unlock” its verts?

Any help would be appreciated.

var oPrefab:GameObject = Instantiate( oTemplatePrefab, oSpawner.position, oSpawner.rotation );
var oMeshFilter:MeshFilter = oPrefab.Find("default").GetComponent("MeshFilter") as MeshFilter;
var oMesh:Mesh = oMeshFilter.mesh;
var oVerts:Vector3[] = oMesh.verticies;
var iCounter:int;

for ( iCounter=0; iCounter<oVerts.length; iCounter++ )
{
	oVerts[iCounter]=oVerts[iCounter]*2;
}

You need to assign the verts back to the mesh; see the examples in the docs.

–Eric

Thanks much for the help, sometimes the obvious thing is the hardest to find.