//fade materials at speed pass and renderer it to MyTransform if is not null private void FadeMaterial(Material one, Material two, float speedPass) { if (one != two) { FadeDirection = "FadeIn"; FloatFadeValue = FadeAction(FadeDirection, two.color.a, speedPass); // print("FloatFadeValue." + FloatFadeValue + name); if (!DestroyNow) { Texture newTexture = two.GetTexture(0); MyTransform.GetComponent <Renderer>().material.SetTexture(0, newTexture); } if (MyTransform != null) { MyTransform.GetComponent <Renderer>().material.Lerp(one, two, FloatFadeValue); } } }