Scenario: Many objects are flying around in my scene ( 2D , around 20 lets say ) and each one of them has a script to fade the object out before being destroyed:
Color color = gameObject.renderer.material.color;
float alpha = color.a;
color.a = Mathf.Lerp(alpha,0,0.01f);
gameObject.renderer.material.color = new Color(color.r,color.g,color.b,color.a);
Debug.Log("Color Fading");
However, at the time when fading begins the fps drops by around 30, so this isnt very performance efficient, is there any more efficient method ?
EDIT: i know it wouldnt matter if it was one object fading at one time, but it will be around 5-15 objects fading at the same time
EDIT 2: using transparent specular shader