想寫個指標進入按鈕文字變色的腳本,測驗指標退出時沒變 哪位大俠幫看下什么問題
腳本如下:
using UnityEngine;
using UnityEngine.EventSystems;
using UnityEngine.UI;
public class ChangeBtnTColor_mulu : MonoBehaviour, IPointerEnterHandler, IPointerExitHandler
{
private Text text;
public GameObject btn;
void Start()
{
}
public void OnPointerEnter(PointerEventData EeventData)
{
Text text = btn.transform.GetComponentInChildren<Text>();
text.text ="<color=#1757E5>"+ text.text +"</color>";
}
public void OnPointerExit(PointerEventData EeventData)
{
Text text = btn.transform.GetComponentInChildren<Text>();
text.text ="<color=#DE2929>"+ text.text +"</color>";
}
}
uj5u.com熱心網友回復:
問題已經解決轉載請註明出處,本文鏈接:https://www.uj5u.com/qita/32339.html
標籤:Unity3D
下一篇:DNF虛擬機同步過檢測防制裁
