void CreateMeshes() { // Create a new mesh for the mesh filter and a grid mesh to reference it MeshFilter meshFilter = GetComponent<MeshFilter>(); meshFilter.sharedMesh = new Mesh(); renderMesh = new GridMesh(renderMeshSize, renderMeshSize, meshFilter.sharedMesh); //renderMesh.recreateMesh = true; renderMesh.update = new GridMesh.UpdateFunction(GridCallback); //renderMesh.updateNormal = new GridMesh.UpdateFunction(GridNormalCallback); renderMesh.Setup(); // Create a new mesh for the mesh collider and a grid mesh to reference it MeshCollider meshCollider = GetComponent<MeshCollider>(); meshCollider.sharedMesh = new Mesh(); collisionMesh = new GridMesh(collisionMeshSize, collisionMeshSize, meshCollider.sharedMesh); //collisionMesh.recreateMesh = true; collisionMesh.update = new GridMesh.UpdateFunction(GridCallback); collisionMesh.Setup(); print ("Initialized: "); PrintVerts(); }