Fading out a square

Hi, I’m fairly new to Unity and I have a cube that I need to fade away to completed transparency and be destroyed. It seems to me from looking through everything that a shader and material would be the way to go, however, I’m not sure how to use these to do what I need. All the things that I find about shaders only have to do with colors. Any help?

I haven’t played around with shaders too much, so take this with a grain of salt (/disclaimer):

  1. apply a texture to your cube that has an alpha channel and use a transparent shader (such as this one)
  2. using Texture2D’s functions (SetPixels), gradually decrease the alpha of the box’s texture according to the logic you have in mind
  3. when the alpha hits 0, destroy the object (gameObject.destroy)