using System.Collections; using System.Collections.Generic; using UnityEngine; using UnityEngine.EventSystems; //public class stay : MonoBehaviour public class Stay : MonoBehaviour, IPointerEnterHandler, IPointerExitHandler { // Start is called before the first frame update private bool isOnUI = false; void Start() { } // Update is called once per frame void Update() { } public void OnPointerEnter(PointerEventData eventData) { isOnUI = true; Debug.Log("鼠标在UI上"); } public void OnPointerExit(PointerEventData eventData) { isOnUI = false; Debug.Log("鼠标不在UI上"); } }