- Home /
SetColor not working?
Hi, I can't get this code to work:
Color ccc = new Color(wall.renderer.material.color.r, wall.renderer.material.color.g, wall.renderer.material.color.b, acolor2);
wall.renderer.material.SetColor("_MainColor", ccc);
What I'm trying to do is to set the "Main Color"'s alpha-value to the "acolor2" value.
There are no errors, it just won't change the alpha-value.
Thanks in advance.
Andreas.
Are you using a shader that takes transparency into account for that material?
Yes I'm using the Transparent>VertexLit shader. It's possible to change the alpha value from the editor.
Your answer
Follow this Question
Related Questions
renderer.material.color not being changed? 2 Answers
troble with the Axis in unity 1 Answer
OnMouseUp not working in build? 0 Answers
How to add color/alpha control to this shader? 0 Answers
Default color issue 2 Answers