设置 unity shader 半透明

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/qq_35759688/article/details/84582053
/// <summary>
/// 设置材质球半透明
/// </summary>
/// <param name="material"></param>
void SetMaterialTransparent(Material[] material)
{
     for (int i = 0; i < material.Length; i++)
     {
           Color color = material[i].color;
          //color.a = Mathf.Lerp(0f, 1f, t);
           color.a = 0.1f;
           material[i].color = color;
           material[i].SetFloat("_Mode", 2f);
           material[i].SetInt("_SrcBlend", 5);
           material[i].SetInt("_DstBlend", 10);
           material[i].EnableKeyword("_ALPHABLEND_ON");
           material[i].renderQueue = 3000;
     }
}

猜你喜欢

转载自blog.csdn.net/qq_35759688/article/details/84582053