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;
}
}
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.