参考代码:
using UnityEngine;
using UnityEngine.EventSystems;
public class DialogEmptyArea : MonoBehaviour, IPointerDownHandler
{
public void OnPointerDown(PointerEventData eventData)
{
if (eventData.pointerCurrentRaycast.gameObject == gameObject)
{
Debug.Log("DialogEmptyArea");
}
}
}