Fading Alpha Channel Over Time

Ive been researching around and am not finding a clear script to work with. I want to fade the opacity of a material over time. Can anyone giving me an example of how this would work?

var _time:float = 3f;    //this is the time you need

void Update()
{
 var temp=renderer.material.color;

 temp.a+=Time.deltaTime/_time;
 renderer.material.color=temp;
}

if the material.color doesnt return the color or throws exception try with material.GetColor() of the property shown in the editor (some shaders have name like TintColor for color!)

There is plenty of ways, here is one :

// Init, when the fading start, called once
// Division is the devil, so I prepare the inverse of the duration
float durationInv = 1f / (duration != 0f ? duration : 1f );
// timer that will go from 0 to duration over time
timer = 0f;

and

// Somewhere in Update, called once per frame
float alpha = Mathf.Lerp( 1f, 0f, timer * durationInv );
timer += Time.deltaTime;
// I'll guess the script is attached to the object you want to fade out, and that you have the appropriate shader.
renderer.material.color = new Color( r, g, b, alpha );

But you could use iTween as well.

If it’s not occuring under any strict circumstances you can always use an animation for it. The material has to be transparent for that to happen in the game though.

You can use LeanTween to fade an object, here is an example:

var time:float = 2.0;
var alphaVal:float = 0.0;
LeanTween.alpha(gameObject, alphaVal, time);

Just make sure that the object has a shader that supports transparency! I would recommend Owl Labs Shaders: http://owlchemylabs.com/content/ (Unlit with Alpha);