using System.Collections; using System.Collections.Generic; using UnityEngine; using UnityEngine.EventSystems; using UnityEngine.UI; using static MainCanvasManager; public class MediaContextMenu : MonoBehaviour, IPointerEnterHandler, IPointerExitHandler { bool is_hovering; public void OnPointerEnter(PointerEventData eventData) { is_hovering = true; } public void OnPointerExit(PointerEventData eventData) { is_hovering = false; } // Start is called before the first frame update void Start() { } // Update is called once per frame void Update() { if (Input.GetMouseButtonDown(0) || Input.GetMouseButtonDown(1) || Input.GetMouseButtonDown(2)) { if (!is_hovering) { //media_viwer_panel.current_media_item = null;//执行删除时按钮OnClick和Update时机问题 media_viwer_panel.context_menu_image.gameObject.SetActive(false); } } } }