Hi to all
I’m trying to make a gameobject to gradually disappear using transparency. I could find out that a nice way to do it, is to set its shader material to ‘Transparent/Cutout/VertexLit
’ , and then, if I modify the ‘Alpha cutoff
’ property to maximum, the object became invisible(fully transparent, doesn’t matter).My question is, how to do this programatically? I have tried this code, but the object disappear instantly, not gradually,as I want, either the value is big or small(theoreticaly 255 is opaque, 0 transparent).The object is textured.
void Update(){
renderer.material.SetFloat("_Cutoff",200);
renderer.material.SetFloat("_Cutoff", 150);
renderer.material.SetFloat("_Cutoff", 100);
renderer.material.SetFloat("_Cutoff", 50);
renderer. material.SetFloat("_Cutoff",0);
}