title: Using a Coroutine in Unity3D to fade a game object out, and back in. Looping infinitely
body: <p>I'm trying to get a game object in Unity 3D to fade out(fade speed should be adjustable from editor), pause/wait 2 seconds (pause length be adjustable from editor), and fade back in, looping infinitely. Coroutine is what I'm trying to utilize here to decrease alpha value but I'm unsure of exactly where I'm making my errors.</p>
  <p>I'm getting a single error. (Cannot convert method group &quot;FadeOut&quot; to non-delegate type &quot;object&quot;)</p>
  <p>Here is my code:</p>
  <pre><code>using System;
  using System.Collections;
  using System.Collections.Generic;
  using UnityEngine;
  
  public class ScriptFader : MonoBehaviour
  {
      // attached game object for fading
      public GameObject Sphere;
  
      // fade speed length
      public float fadeSpeed;
  
      //Pause length between fades
      public int fadePause;
  
      void Awake()
      {
          StartCoroutine(FadeOut(fadeSpeed));
      }
  
  
      //Fade Out Coroutine
      public IEnumerator FadeOut(float fadeSpeed)
      {
          Renderer rend = Sphere.transform.GetComponent&lt;Renderer&gt;();
          Color matColor = rend.material.color;
          float alphaValue = rend.material.color.a;
  
  
          //while loop to deincrement Alpha value until object is invisible
          while (rend.material.color.a &gt; 0f)
          {
              alphaValue -= Time.deltaTime / fadeSpeed;
              rend.material.color = new Color(matColor.r, matColor.g, matColor.b, alphaValue);
              yield return new WaitForSeconds(fadePause);
          }
          rend.material.color = new Color(matColor.r, matColor.g, matColor.b, 0f);
          StartCoroutine(FadeIn(fadeSpeed));
      }
  
      //Fade In Coroutine
      public IEnumerator FadeIn(float fadeSpeed)
      {
          //waits for the return value of FadeOut coroutine to commence
          yield return FadeOut;
  
          Renderer rend = Sphere.transform.GetComponent&lt;Renderer&gt;();
          Color matColor = rend.material.color;
          float alphaValue = rend.material.color.a;
  
  
          //while loop to increment object Alpha value until object is opaque
          while(rend.material.color.a &lt; 1f)
          {
              alphaValue += Time.deltaTime / fadeSpeed;
              rend.material.color = new Color(matColor.r, matColor.g, matColor.b, alphaValue);
              yield return null;
          }
          rend.material.color = new Color(matColor.r, matColor.g, matColor.b, 1f);
          StartCoroutine(FadeOut(fadeSpeed));
      }
  }
  </code></pre>