using UnityEngine;
using System.Collections;
/// <summary>
/// Random Vertex Color
/// Assigns a random color to each vertex on update. Requires a vertex color shader to have visible results.
/// Author: Bishop Myers
/// Last modified: October 7, 2014
/// </summary>
public class RandomVertexColor : MonoBehaviour
{
void Update ()
{
Mesh mesh = GetComponent<MeshFilter>().mesh;
Vector3 vertices = mesh.vertices;
Color colors = new Color;
for (int i = 0; i < vertices.Length; i++)
{
colors = new Color(Random.Range(0.0f,1.0f),
Random.Range(0.0f,1.0f),
Random.Range(0.0f,1.0f));
}
mesh.colors = colors;
}
}