/// <summary> /// On any item drag start need to disable all items raycast for correct drop operation. /// </summary> /// <param name="item"> dragged item </param> private void OnAnyItemDragStart(GameObject item) { if (myDadItem != null) { myDadItem.MakeRaycast(false); // Disable item's raycast for correct drop handling } }
/// <summary> /// Put item into this cell. /// </summary> /// <param name="item">Item.</param> /// <param name="destroyOldItem">If set to <c>true</c> destroy old item.</param> private void PlaceItem(GameObject item, bool destroyOldItem) { if (item != null) { if (destroyOldItem == true) { DestroyItem(); // Remove current item from this cell myDadItem = null; } DadItem dadItem = item.GetComponent <DadItem>(); if (dadItem != null) { // Put new item into this cell item.transform.SetParent(transform, false); item.transform.localPosition = Vector3.zero; dadItem.MakeRaycast(true); myDadItem = dadItem; } } UpdateBackgroundState(); }