public Color newColor = Color.grey;
private MeshFilter _meshFilter;
private Mesh _mesh;
private Color[] _colors;
void Awake()
{
_meshFilter = gameObject.GetComponent<MeshFilter>();
_mesh = _meshFilter.mesh;
_colors = new Color[_mesh.vertices.Length];
}
void Update()
{
int i = 0;
while (i < _mesh.vertices.Length) {
//set new vertex color
_colors[i] = newColor;
++i;
}
_mesh.colors = _colors;
}