Fading an object via script

How would you fade out an object via script? I've got a cube that needs to completely disappear - slowly fading out, not just turning off the rendering. I tried the example from the documentation, but it doesn't seem to do the trick. The cube just disappears instantly; not the effect I was looking for. Here's the code I have currently:

 var colorStart = Color.red;
 var colorEnd = Color.green;
 var duration = 1.0;

 function Update () {
     var lerp = Mathf.PingPong (Time.time, duration) / duration;
     renderer.material.color = Color.Lerp (colorStart, colorEnd, lerp);

It's directly copied from the docs but won't fade over time - it's instantaneous. I would appreciate a pointer or two.

Thanks in advance - Elliot Bonneville

You need to use a transparent shader, not a transparent cutout shader (which is what I'm guessing you're using).