I have this code that is supposed to fade out the rotating yellow cube. But once the alpha reaches 0, it continues one more time until the alpha reaches -0.200 and the cube becomes blue before disapearing.
if (disapear)
{
if (rndr.material.color.a > 0.0f)
{
rndr.material.color -= new Color(0, 0, 0, 0.2f);
Debug.Log(rndr.material.color);
}
else
{
gameObject.SetActive(false);
}
}
EDIT: There is no problem for the red finish line wich uses the same code.
Aucun commentaire:
Enregistrer un commentaire