using UnityEngine; using UnityEngine.EventSystems; using UnityEngine.UI; /// /// 鼠标进出图片切换 /// public class EnterExitImageChange : MonoBehaviour, IPointerEnterHandler, IPointerExitHandler { public Sprite PointerEnterSprite; public Sprite PointerExitSprite; public Image mImage; public void OnPointerEnter(PointerEventData eventData) { mImage.sprite = PointerEnterSprite; } public void OnPointerExit(PointerEventData eventData) { mImage.sprite = PointerExitSprite; } public void BtnClickExecute() { mImage.sprite = PointerExitSprite; } }