title: Unity fade image alpha over time
body: <p>I'm wanting to change the alpha of my UI Images gradually instead of instantly. So far my code for fading the alpha of my image instantly is as follows</p>
  
  <pre><code>public void Highlight()
  {
      foreach (Image image in imagesToHighlight)
      {
          Color c = image.color;
          if(c.a &lt; maxColor)
          {
              c.a = maxColor;
          }
  
          image.color = c;
      }
  
      foreach (Image image in imagesToFade)
      {
          Color c = image.color;
          if(c.a &gt; halfColor)
          {
              c.a = halfColor;
          }
          image.color = c; 
  
      }
  
  }
  </code></pre>
  
  <p>The above code works fine, but I'm struggling to modify my code so that instead of doing it instantly, it does it slowly over a second or two. I've tried changing the line <code>c.a = maxColor;</code> to <code>c.a--</code> in order to see if the image would continually fade out slowly but the alpha just instantly drops. </p>
  
  <p>What am I doing wrong?</p>