Button onClick event not fired when application window lose focus

1 SubMenus[0].GetComponent().onClick.AddListener(BtnSubMenuNew);
2 public void OnDrag(PointerEventData eventData)//It has the same problem

It’s OK when play in U3D editor.

I tried to fix it ,but still not working :frowning:

bool lostFocus = false;
private void OnApplicationFocus(bool focus)
{
if (focus && lostFocus)
{
lostFocus = false;
var pointer = new PointerEventData(EventSystem.current);
ExecuteEvents.Execute(EventSystem.current.currentSelectedGameObject, pointer, ExecuteEvents.pointerClickHandler);
}
else
lostFocus = true;
}