public void OnDrop(PointerEventData eventData) { draggedUnit = eventData.pointerDrag.GetComponent <DragAndDrop>(); if (eventData.pointerDrag != null && activeUnit == null) { draggedUnit.SetParentToNull(); draggedUnit.BlockRaycasts(true); eventData.pointerDrag.GetComponent <RectTransform>().anchoredPosition = GetComponent <RectTransform>().anchoredPosition; print("Changing active unit!"); activeUnit = eventData.pointerDrag.GetComponent <Unit>(); draggedUnit.SetActive(true); draggedUnit.SetParent(this); } }