OnEndDrag event not called after alt+tab : bugs or wrong event ?

I have a quite simple class that handle item dragging using the following events :

public void OnBeginDrag(PointerEventData eventDat)
public void OnDrag(PointerEventData eventData)
public void OnEndDrag(PointerEventData eventDat)
public void OnDrop(PointerEventData eventData)

OnDrag moves the item based on mousePosition.
OnDrop/OnEndDrop move it back to its original position.

It works fines, unless the user switch the app while dragging, for instance using alt+tab on windows.
Then, when switch back to the app OnEndDrag or OnDrop are never called. So the item position can not be reset. But at the same time OnDrag is not anymore called , so it’s like the dragging have ended, without event.

It looks like a bug for me, but maybe it is not , and I should listen to another event, but I have no idea which one …

Did anybody had the same problem, or have an idea how I could fix that ?

Thank you.

you can work around the fact that it does not even call OnDrag() anymore, by storing your own bool called say isDragging. Set it to true in onBeginDrag() and false in OnEndDrag().

In your Update function, you can check if this bool is true, AND that the mouse button is down. if dragging is true, but the Pointer is not “down”, then manually call onEndDrag();