A game about forced loneliness, made by TACStudios
1using UnityEngine;
2using UnityEngine.EventSystems;
3
4public class DragCallbackCheck : MonoBehaviour, IBeginDragHandler, IDragHandler, IEndDragHandler, IDropHandler, IPointerDownHandler
5{
6 private bool loggedOnDrag = false;
7 public bool onBeginDragCalled = false;
8 public bool onDragCalled = false;
9 public bool onEndDragCalled = false;
10 public bool onDropCalled = false;
11
12 public void OnBeginDrag(PointerEventData eventData)
13 {
14 onBeginDragCalled = true;
15 }
16
17 public void OnDrag(PointerEventData eventData)
18 {
19 if (loggedOnDrag)
20 return;
21
22 loggedOnDrag = true;
23 onDragCalled = true;
24 }
25
26 public void OnEndDrag(PointerEventData eventData)
27 {
28 onEndDragCalled = true;
29 }
30
31 public void OnDrop(PointerEventData eventData)
32 {
33 onDropCalled = true;
34 }
35
36 public void OnPointerDown(PointerEventData eventData)
37 {
38 // Empty to ensure we get the drop if we have a pointer handle as well.
39 }
40}