I’m trying to find a way to transition between three colors on one light.
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class RTB : MonoBehaviour {
public float duration = 1.0F;
public Color color0 = Color.red;
public Color color1 = Color.blue;
public Color color2 = Color.green;
public Light lit;
void Start()
{
lit = GetComponent<Light>();
}
void Update()
{
float t = Mathf.PingPong(Time.time, duration) / duration;
lit.color = Color.Lerp(color0, color1, t);
}
}
I was using Lerp before, but instead of just using “color0, color1, t” I need “color0, color1, color2, t”
I don’t know what to use to add all three.