public void OnDrop(PointerEventData eventData) { //Debug.Log (eventData.pointerDrag.name + " OnDrop to " + gameObject.name); Dragable dropedObject = eventData.pointerDrag.GetComponent <Dragable>(); if (dropedObject != null && !occupied) { // removing the object from the previous DropZone && unregistering it if (dropedObject.GetDropZoneParent() != null) { DropZone dod = dropedObject.GetDropZoneParent(); // Droped Object Dropzone int dodsn = dod.GetSlotNumber(); // Droped Object Dropzone Slot Number dod.objectInThisSpot = null; GCDnD.unsetInputHiragana(dodsn); } dropedObject.parentToReturnTo = this.transform; objectInThisSpot = eventData.pointerDrag; int slotNum = this.GetSlotNumber(); GCDnD.setInputHirgana(slotNum, eventData.pointerDrag.name); this.transform.GetComponent <Image>().color = colorWhite; } else if (dropedObject != null && occupied) { int slotNum = -1; // Object In this spot handler for moving to new spot Transform parentTransform = dropedObject.parentToReturnTo; DropZone parentDropZone = parentTransform.GetComponent <DropZone>(); if (parentDropZone != null) { parentDropZone.objectInThisSpot = objectInThisSpot; } objectInThisSpot.GetComponent <Dragable>().parentToReturnTo = dropedObject.parentToReturnTo; objectInThisSpot.transform.SetParent(dropedObject.parentToReturnTo); objectInThisSpot.transform.SetSiblingIndex(dropedObject.GetPlaceholderSiblingIndex()); if (dropedObject.GetDropZoneParent() != null) { slotNum = dropedObject.GetDropZoneParent().GetSlotNumber(); GCDnD.setInputHirgana(slotNum, objectInThisSpot.name); } dropedObject.parentToReturnTo.transform.GetComponent <Image>().color = colorWhite; // Object coming into this spot handler dropedObject.parentToReturnTo = this.transform; eventData.pointerDrag.transform.SetParent(this.transform); objectInThisSpot = eventData.pointerDrag; slotNum = this.GetSlotNumber(); GCDnD.setInputHirgana(slotNum, eventData.pointerDrag.name); this.transform.GetComponent <Image>().color = colorWhite; } //Debug.Log("Occupied = " + occupied); }