public void OnDrop(PointerEventData data) { GameObject fromItem = data.pointerDrag; if (data.pointerDrag == null) { return; // (will never happen) } UNCDraggable d = fromItem.GetComponent <UNCDraggable>(); if (d == null) { // means something unrelated to our system was dragged from. // for example, just an unrelated scrolling area, etc. // simply completely ignore these. return; // note, if very unusually you have more than one "system" // of UNCDraggable items on the same screen, be careful to // distinguish them! Example solution, check parents are same. } Debug.Log("dropped " + fromItem.name + " onto " + gameObject.name); // your code would look probably like this: YourThings fromThing = fromItem.GetComponent <YourButtons>().info; YourThings untoThing = gameObject.GetComponent <YourButtons>().info; yourBossyObject.dragHappenedFromTo(fromThing, untoThing); }
public void OnDrop(PointerEventData data) { GameObject fromItem = data.pointerDrag; if (data.pointerDrag == null) { return; } UNCDraggable d = fromItem.GetComponent <UNCDraggable>(); if (d == null) { return; } }