using System.Collections; using System.Collections.Generic; using UnityEngine; using UnityEngine.EventSystems; using UnityEngine.UI; // 鼠标移入UI时改变UI public class MouseMoveChangeUI : MonoBehaviour,IPointerEnterHandler,IPointerExitHandler { public Color enterColor=new Color(1f,1f,1f,0.5f); public Color exitColor=new Color(1f,1f,1f,1f); private Image image; // 被改变的图片 private void Start() { image = GetComponent(); } public void OnPointerEnter(PointerEventData eventData) { image.color = enterColor; } public void OnPointerExit(PointerEventData eventData) { image.color = exitColor; } }