How to FadeIn 3dObject using alpha color?

Hello everyone I know this question was asked a multiple times, but non of the solutions from other question gived me a result I want.

Here is the code example that I tried first, it changes the value of RGBA but it’s not returning them to material, basically I don’t understand how to return “Color” to material.

Color col = GetComponent<MeshRenderer>().material.color;
col.a = 0.4f;

And a second example just gives me a material error.

Renderer rend = GetComponent<Renderer>()
rend.material.SetColor("_SpecColor", new Color(1, 1, 1, 0.5f));

Anyone can you please give some advice.

Sorry for double question, found the way of doing it.
in answer of @joe_bar from this question: Fading out using render.material.color.a +=/-= doesn't work - Questions & Answers - Unity Discussions

Here is the code excample that worked for me:

Renderer rend = GetComponent<Renderer>();
rend.material.color -= new Color(0, 0, 0, 0.9f);

Sorry for self answering.

Adding one more thing for those who going to use it in “for” loop use it with double.

for (double i = 0; i < 1.0;)
i = i - 0.1;
float a = (float)i;
GetComponent<Renderer>().material.color = new Color(1, 1, 1, a);

Then it will work properly.