将含改代码的脚本挂到UI上,可实现相应效果
using UnityEngine; using UnityEngine.EventSystems; public class Juse : MonoBehaviour,IPointerEnterHandler,IPointerExitHandler { public void OnPointerEnter(PointerEventData eventData) { Debug.Log("Enter"); } public void OnPointerExit(PointerEventData eventData) { Debug.Log("Exit"); } }
标签:UnityEngine,Log,void,接口,PointerEventData,事件,eventData,public From: https://www.cnblogs.com/gatran/p/17280603.html