public void OnEndDrag(PointerEventData pointerEvent) { transform.SetParent(Parent); transform.position = Parent.position; if (pointerEvent.pointerCurrentRaycast.isValid) { if (pointerEvent.pointerCurrentRaycast.gameObject.GetComponent <InventorySlot>() is InventorySlot slot && slot.Empty) { invHandler.Move(slotId, slot.Id); transform.SetParent(pointerEvent.pointerCurrentRaycast.gameObject.transform); transform.position = transform.parent.position; slotId = slot.Id; Parent = transform.parent; UsedEvent?.Invoke(); } else if (pointerEvent.pointerCurrentRaycast.gameObject.GetComponent <EquipmentSlot>() is EquipmentSlot equipSlot) { UseItem(); } else { Debug.Log("Do you want to remove"); invHandler.Move(slotId); } }