using System.Collections;
public class BBB : MonoBehaviour {
public float sp = 0.4f;
Material mat;
// Use this for initialization
void Start () {
}
// Update is called once per frame
void Update () {
foreach (Transform child in gameObject.transform)
{
//Debug.Log("所有该脚本的物体下的子物体名称:"+child.name);
mat = child .GetComponent<MeshRenderer>().material;
//mat.color = Color.blue;
Color col = mat.GetColor("_TintColor");
col.a = Mathf.Lerp(col.a,0, Time.deltaTime*sp);
mat.SetColor("_TintColor",col);
}
}
}
Paste_Image.png
网友评论