- Home /
This question was
closed Jan 06, 2019 at 10:40 AM by
baumxyz for the following reason:
The question is answered, right answer was accepted
Fade emission color using standard shader
I'm trying to fade between emission colors. My problem is that the emission color is set exactly once. After that the script won't change the emission color again. I checked the debugger and the color object is changing correctly. Only the rendered emission color is incorrect.
void Update ()
{
// ... more code ...
float t = Mathf.PingPong(Time.time, slowFlashInterval);
currentColor = Color.Lerp(Color.black, flashColor, t);
body.GetComponent<Renderer>().material.SetColor("_EmissionColor", currentColor);
body.GetComponent<Renderer>().material.EnableKeyword("_EMISSION");
// ... more code ...
}
Comment
Best Answer
Answer by baumxyz · Jan 06, 2019 at 10:40 AM
Solved the problem. I initialized my flashColor
with new Color(120.0f, 120.0f, 120.0f, 1.0f);
but the parameters only have a range from 0 to 1.