- Home /
Changing LineRenderer color over time in update
I have searched all over and cant seem to find the answer that works for me. Basically I am trying to change the color of a LineRenderer over a specific time interval so it may change to a randomly created Color value. I can Debug.log my new color and it works there, but in the actual game itself the lines are still white and not the given new color. The commented portion of my code is another way that I tried but still did not have success with. Here is my code:
and here is my console output:
Answer by DCordoba · May 11, 2019 at 11:25 AM
the problem is... the Color run between (0f,1f) values, 255 is far away overflow, probably will always be clamped to 1, so, change line ?
with
Color newColor = new Color(Random.Range(0f,1f), Random.Range(0f,1f), Random.Range(0f,1f), 1f);
Awesome thank you, it worked. I didn't realize it was a 0-1 range and not up to 255.
Your answer
Follow this Question
Related Questions
Make the cube have the same color as the background every 3 seconds 0 Answers
Line Renderer Appears Semi-Transparent instead of White? 1 Answer
Quad Gradual Colour Change 1 Answer
Instantiating multiple sprites and assigning different colors for each 1 Answer
Array of colors not working, all sprites turn white. 1 Answer