I’m trying to grab the color of a cube and change it over time using the lerp function
But it says the color does not contain the definition for red and even for green.
public Color inicolor;
public Color redColor = Color.white;
public Color blackColor = Color.black;
void Awake()
{
inicolor = gameObject.GetComponent<Color>();
}
void Update ()
{
colorchanged ();
}
void colorchanged()
{
if (Input.GetKey (KeyCode.A)
inicolor = redColor;
else
inicolor = blackColor;
renderer.material.color = Color.Lerp(renderer.material.color,inicolor, Time.deltaTime * 5);
}