using System.Collections.Generic;
using UnityEngine;
using UnityEngine.EventSystems;
public class Script_5 : MonoBehaviour,IPointerClickHandler {
public void OnPointerClick(PointerEventData eventData)
{
Debug.LogError("图片点击");
PassEvent(eventData, ExecuteEvents.pointerClickHandler);
}
public void PassEvent<T>(PointerEventData data, ExecuteEvents.EventFunction<T> function) where T : IEventSystemHandler
{
List<RaycastResult> results = new List<RaycastResult>();
EventSystem.current.RaycastAll(data, results);
GameObject current = data.pointerCurrentRaycast.gameObject;
for (int i = 0; i < results.Count; i++)
{
if (current != results[i].gameObject)
{
ExecuteEvents.Execute(results[i].gameObject, data, function);
}
}
}
}
using UnityEngine;
public class Script_5_1 : MonoBehaviour {
public void OnButtonClick()
{
Debug.LogError("按钮点击");
}
}

