Change alpha on material with custom shader
I have custom shared which blur background and it works well (you can see code here: https://pastebin.com/wVxpxpvt).
I would like to fade it over time which means I have to access its alpha channel. I need to access it from c#, this is where I set it in inspector
I tried something like:
img.material.color -= new Color(0, 0,
0, 20f);
or
Color color = renderer.material.color;
color.a -= 0.1f;
renderer.material.color = color;
Nothing seems to change the alpha, but I can change its color easily.
Any suggestions ?
Comment
Your answer
Follow this Question
Related Questions
Unity 5 change source image of UI image c# script 2 Answers
Scaling an image sent to UI Image 0 Answers
What Am I doing Wrong Here 1 Answer
RectTransform Left Right Bottom Top 0 Answers
UI RectTransform.rect.width/heigth returns incorrect/negative values 0 Answers