title: C# Unity IEndDragHandler OnEndDrag not always called
body: <p>I'm coding inventory window in Unity, which looks similar to point&amp;click games. There is canvas which has child object (equipment window image), which has children objects created in loop (slots), and each slot has child (image item inside slot). Each image item (slot's child) has attached special script which allows to handle drag and drop. The main part of the script is following: </p>
  
  <pre><code>    public InventoryPatternItem PatternItem;
  
      private Vector3 defaultPosition;
  
      public void OnBeginDrag (PointerEventData eventData)
      {
          this.GetComponent&lt;CanvasGroup&gt;().blocksRaycasts = false;
          EquipmentManager.Instance.SelectedSlot = this.gameObject;
          this.transform.parent.SetAsLastSibling();
      }
  
      public void OnDrag(PointerEventData eventData)
      {
          transform.position = eventData.position;
      }
  
      public void OnEndDrag(PointerEventData eventData)
      {
          this.GetComponent&lt;CanvasGroup&gt;().blocksRaycasts = true;
          EquipmentManager.Instance.SelectedSlot = null;
          this.transform.localPosition = this.defaultPosition;
      }
  
      public void OnDrop(PointerEventData eventData)
      {
          this.TryToConnectDroppedItems();
      }
  </code></pre>
  
  <p>When I hold mouse button over the image, click on item, it's following the mouse, next after releasing mouse button it goes back to the slot but in many cases it suddenly it goes stuck. Especially if FPS will get lower than 30 frames, then it's happening often. I added Debug.Log to functions OnBeginDrag, OnDrag, and OnEndDrag and it appeared that when item stucks, OnEndDrag doesn't get called. Also blocksRaycasts method is blocking item totally making it unable to move, so it stucks in slot or between two slots, or sometimes on another slot. But without it I'm not able to check if I can connect item with other one I'm putting item on. For now the only solution is to close (setActive(bool)) and open inventory again to make items sort and able to work. </p>
  
  <p>My question is, what am I doing wrong, is this my fault somewhere? Did I write it wrongly? Or maybe it's unity glitch?</p>
  
  <p>I'm adding a video my friend made, to make the problem clear: <a href="https://www.youtube.com/watch?v=2ue0RxeqDQk" rel="nofollow noreferrer">https://www.youtube.com/watch?v=2ue0RxeqDQk</a></p>
  
  <p>Also GFY: <a href="https://gfycat.com/HealthyHeartyAsiaticgreaterfreshwaterclam" rel="nofollow noreferrer">https://gfycat.com/HealthyHeartyAsiaticgreaterfreshwaterclam</a></p>