fade script need help

I have made this script to fade all the components in a object but it is not working. what did i do wrong?

var fade=55.0;  
var Fade = false;

function Update () {

if (Fade){
fade--;
}
var renderers : MeshRenderer[];
		
		renderers = GetComponentsInChildren (MeshRenderer) as MeshRenderer[];
		
			for (var renderer : MeshRenderer in renderers) {
				renderer.material.color.a = fade;
			}
		
}

bump

it could be fading too fast to see? are you getting errors? does it disappear ? does stay the same? is fade true when the script starts?? is this a single object or multiple being cast?

i cant tell if we don’t know some of these. please explain it more

you say “it’s not working”, but what is it doing?
You’re decrementing fade every update. At 60 updates per second, this would take less than a second to fade.

Have you tried outputting to your console? Have you tried any other debug methods?

You really need to be more specific as to what you want the script to do before we can point out what you did wrong. :slight_smile:

Alpha is usually a value between 0.0 and 1.0. You’re starting at 55

it dos fade but to fast to see it.
i don’t thank it works on the child objects.

i thank i need to change “fade–” to “fade–0.1” or some thing like that.

The ShaderDatabase.js in the Angrybots project has a fading example.

ok i will look at it.