unity 修改按钮下面的文本字体 设置透明度变化 字体大小 以及字体粗体形式

public void Chanage(int index)
{

    //1:先吧上一个按钮颜色变化了
    LastBtn.GetComponent().DOFade(0, 0.6f);
    LastBtn.transform.Find("Text").GetComponent().fontSize = 18;
    LastBtn.transform.Find("Text").GetComponent().fontStyle = FontStyle.Normal;
    LastBtn.transform.Find("Text").GetComponent().color = new Color32(119, 124, 125, 255);
    //2:改变当前按钮的颜色变化
    btn_list[index].GetComponent().DOFade(1, 0.6f);
    btn_list[index].transform.Find("Text").GetComponent().fontSize = 22;
    btn_list[index].transform.Find("Text").GetComponent().fontStyle = FontStyle.Bold;
    btn_list[index].transform.Find("Text").GetComponent().color = new Color32(51,53,56,255);
    //2:吧上一个的引用变成当前这个按钮
    LastBtn = btn_list[index];
}

你可能感兴趣的:(unity,unity,游戏引擎,c#)