Here is a souped up Timed Delete script I made:
var emitter = false;
var emitTimeOut = 0.500;
var deleteTimeOut = 1.000;
function Awake ()
{
if(emitter) Invoke ("StopNow", emitTimeOut);
Invoke ("DestroyNow", deleteTimeOut);
}
function StopNow ()
{
particleEmitter.emit = false;
}
var detachChildren = false;
function DestroyNow ()
{
if (detachChildren) {
transform.DetachChildren ();
}
DestroyObject (gameObject);
}
var fadeOut = false;
var fadeSeconds = 0.000;
private var timer = 0.0000000000000;
function Update ()
{
timer += Time.deltaTime;
renderer.material.color.a = timer / fadeSeconds;
}
The fading part at the bottom is where the script is failing. It compiles ok but fails to fade anything out. When I run the game the material changes to an instance of its self but the opacity never changes. I know the object I am using it on can be faded by changing the material opacity.