・ I am studying the mechanism such as coroutines.

I created a blank "Cube" and added a script with "Add Component".
・ I wrote a script based on the above Unity official website as "reference".
"Assets \ TestScript.cs (21,19): error CS0619:
'Component.renderer' is obsolete:'Property renderer has been deprecated.
Use GetComponent() instead. (UnityUpgradable)' "
I got an error, so I tried to fix it.
I changed "renderer" to "GetComponent()".
(There is no error in the corrected one)

However, when I try to move it, it should be "the coroutine gradually makes the Cube transparent", but it does not change at all.
→ I want to correct it so that it gradually becomes transparent. Also, I would like to know the reason why it cannot be done.

Cube does not gradually become transparent when I press "F" on the keyboard.
There are no error messages.

Corresponding source code

In "C #" of "Unity"
using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class TestScript: MonoBehaviour
void Update ()
if (Input.GetKeyDown ("f"))
Start Coroutine ("Fade");
IEnumerator Fade ()
for (float f = 1f;f>= 0;f-= 0.1f)
Color c = GetComponent(). Material.color;
c.a = f;
GetComponent(). Material.color = c;
yield return null;
Debug.Log ("Coroutine" + c);

What I tried

I thought it would be useless if I didn't add the material, so I tried it, but nothing changed.
The values ​​of "f" and "c" changed in Debug.Log (), and it seems that the coroutine was working properly.

Supplementary information (FW/tool version, etc.)

Environment: Windows10Home
Unity: Version2018.4.20f1 Personal