Trouble with input focus (UI vs Game)

This code does not work in new versions, here is updated one. Btw. using object iterator is horrible solution, however I have not found better way.

bool UCOMStaticLibrary::IsMouseOnWidget()
{
	// @todo TObjectIterator is not nice
	for (TObjectIterator<UWidget> WidgetItr; WidgetItr; ++WidgetItr)
	{
		TSharedPtr<SWidget> SafeWidget = WidgetItr->GetCachedWidget();

		if (SafeWidget.IsValid() && SafeWidget->IsDirectlyHovered())
		{
			return true;
		}
	}

	return false;
}