I wanted to lerp 2 materials and i followed by unity documentation. but after i notice that Materials Lerps Every Time.I want that the only first lerp will be and the lerp will stop.
Here is the code:
public Material[] Materials = new Material[2];
public Renderer ob;
public float speed = 2f;
void Update ()
{
float lerp = Mathf.PingPong(Time.time, speed) / speed;
ob.material.Lerp(Materials[0], Materials[1], lerp);
}