“Color.Lerp();” is not working as I wanted, no matter what I did it didn’t work why? Does anyone have an idea? I would be very happy if you could help me
for example, I set the rabbitGroundTime variable to 180f, normally it should shift to the color I want with lerp in 180 seconds, but even though rabbitGroundTime is 180f, it turns to the color I want in 3 seconds, I can’t solve the problem, I accessed all the channels (r,g,b,a) in the myColor variable one by one and did “Mathf.Lerp();” but that didn’t work either? why?
Well, you use Lerp the wrong way. You use the “current” value as start value of the lerp and you also increase the percentage to lerp between start and end. So you get a non linear increase. You need to store the start and end value and keep them constant in order to lerp linearly.
An alternative would be to use something like MoveTowards. However Color doesn’t have such a method. Though a Color value can be converted into a Vector4 and you could use Vector4.MoveTowards. With this method you would need to use the current value and the target value as well as the speed at which to move towards the target.