- Home /
Question by
$$anonymous$$ · Oct 30, 2013 at 02:11 PM ·
errorshadercolorcolor.lerp
Color.Lerp with Particles/Additive shader
Hello! Im trying to change smoothly color of an object with Particles/Additive shader.
I wrote this :
renderer.material.SetColor("_TintColor",Color.Lerp(renderer.material.color,new Color(0,0.29f,0,0.5f),Time.deltaTime * changingSpeedColor));
This works for Diffuse shader, but im getting this error if im using Particles/Additive shader:
Material doesn't have a color property '_Color'
I understand that this shader has property "_TintColor". How can i fix this?
Comment
Best Answer
Answer by sethuraj · Oct 30, 2013 at 03:04 PM
because 'renderer.material.color' in lerp reads _Color property of the shader which is not present in Additive Shader.
Use it like this.
renderer.material.SetColor("_TintColor",Color.Lerp(renderer.material.GetColor("_TintColor"),new Color(0,0.29f,0,0.5f),Time.deltaTime * changingSpeedColor));
Hope this helps.... :-)