- Home /
Colour Lerp on 2D point lighting for fire effect.
I have an array of colours for fire, I also have an array for fires.
I am using the 2D point light, the colours are updating, but they are not switching gradually.
This script is contained within the Update() function.
I am trying to randomly switch between the colours but rather than just jump from colour to colour I need to blend them as they switch.
I have tried the following but Color.Lerp doesn't blend the colours in this way.
.
for (int i = 0; i < fires.Length; i++) {
fires[i].color = Color.Lerp(oldColor, fireColors[Random.Range(0, fireColors.Length)], 1); ;
oldColor = fires[i].color;
}
.
Answer by xxmariofer · Feb 16 at 07:22 AM
with that code it should not even be changing colors, the "2" should be a value between 0, 1 , that increase over time, and you should change oldColor to fires[i].color once the value between 0,1 reaches 1, not inside a for loop
Your answer
![](https://koobas.hobune.stream/wayback/20220613053059im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
Color.lerp not working properly 2 Answers
smoothly switch between 2 colors that are using lerp 2 Answers
Ambient Light not working with some objects 1 Answer
Color.Lerp doesn't go until white. Why? 2 Answers