This code should take the colors from the array and put them randomly on he cube GameObject; but i get that error. (C#)
public GameObject cube;
public Color[] cubeColor;
void Update ()
{
if (Input.GetKeyDown (KeyCode.Space))
{
cube.GetComponent<Renderer> ().material.color = ChangeColor(cubeColor [Random (0, cubeColor.Length)]);
}
}
Color ChangeColor(Color newColor)
{
return newColor;
}