使用coroutine实现颜色动画渐变
yeild return new WaitForSeconds(等待时间)
第一种
cube.GetComponent<MeshRenderer>().material.color = new Color(i,i,i,i);
第二种
Color color = color.GetComponent<MeshRenderer>().matrial.color;
Color newColor = Color.Lerp(color,Color.red,0.02f);
color.GetComponent<MeshRenderer>().matrial.color = newColor;
yeild return new WaitForSeconds(0.02);
if(Mathf.Abs(Color.red.g-newColor..g<=0.01f){
break;
}