UGUIEventWrapper.cs 597 B

123456789101112131415161718192021222324252627
  1. using UnityEngine;
  2. using UnityEngine.Events;
  3. using UnityEngine.EventSystems;
  4. namespace Rokid.UXR.Utility {
  5. public class UGUIEventWrapper : MonoBehaviour, IPointerDownHandler, IPointerClickHandler
  6. {
  7. [SerializeField]
  8. public UnityEvent WhenPointerDown;
  9. [SerializeField]
  10. public UnityEvent WhenPointerClick;
  11. private void Start()
  12. {
  13. }
  14. public void OnPointerDown(PointerEventData eventData)
  15. {
  16. WhenPointerDown?.Invoke();
  17. }
  18. public void OnPointerClick(PointerEventData eventData)
  19. {
  20. WhenPointerClick?.Invoke();
  21. }
  22. }
  23. }