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?

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… :slight_smile: