I am trying to change the color tint of one sprite in this way:
sprite.renderer.material.color=Color.red;
But it is not working and the sprite remains in his original material color (white).
The shader is the standard particle/alpha blended and when changed the material color in the Inspector it is showed correctly…
However when I use:
sprite.renderer.enabled=false
it does work and the sprite “dissapear” like expected.
That shader doesn’t have a _Color property, which is why “material.color = Color.red” doesn’t work, since that’s a shortcut for “material.SetColor (”_Color", Color.red)". If you look in the shader, you can see they used _TintColor instead. (Which is a bit arbitrary if you ask me.)
Yes, as I mentioned, “material.color = Color.red” is a shortcut for “material.SetColor (”_Color", Color.red)". The particle/alpha blended shader uses _TintColor rather than _Color. I’m sure you can figure it out from here.
Yes, I had tried that before asking the last time but I forgot to include the quotation marks in “_TintColor” and I got an error, and I thought it was not so easy to fix, Thanks.