Hi everyone! I made a code that changes the color of the object when I hover over it with my cursor, but Unity says this error every time: The type name ‘Lerp’ does not exist in the type ‘Color’
using UnityEngine;
using System.Collections;
public class Interactions : MonoBehaviour {
private Color startcolor;
private Color lerpedColor;
void OnMouseEnter(){
StartCoroutine(Lerp());
}
IEnumerator Lerp(){
yield return new WaitForSeconds(1f);
startcolor = GetComponent<Renderer>().material.color;
lerpedColor = new Color.Lerp(startcolor, (27, 17, 46), 1.0f);
GetComponent<Renderer>().material.color = lerpedColor;
}
void OnMouseExit(){
GetComponent<Renderer>().material.color = startcolor;
startcolor = GetComponent<Renderer>().material.color;
lerpedColor = new Color.Lerp((27, 17, 46), startcolor, 1.0f);
GetComponent<Renderer>().material.color = lerpedColor;
}
}