Код: Выделить всё
public Renderer engineBodyRenderer;
public float speed;
public Color startColor, endColor;
float startTime;
// Start is called before the first frame update
void Start()
{
startTime = Time.time;
ChangeEngineColour();
}
public void ChangeEngineColour()
{
float t = (Time.time - startTime) * speed;
engineBodyRenderer.material.color = Color.Lerp(startColor, endColor, t);
}
Подробнее здесь: https://stackoverflow.com/questions/567 ... color-lerp
Мобильная версия