Interface button clicked, but sometimes not executing On Clicked event node | Anybody know why this happens or how to fix it?

Here is a video I recorded showing the problem:

If clicking at about the same time the widget button appears, it sometimes seems to not recognize that the mouse is hovering over it, and following clicks do not execute the On Clicked event associated with the button until the cursor leaves the button and re-hovers over it.

I have the button set to be colored red when hovered over, blue for when pressed, and gray for neither. Does anybody know why this happens or any work-arounds?

This was recorded on a new project with a 3rd person template, with the only edits as far as I remember being to the 3rd person character blueprint, creating the widget, the widget blueprint, and the project settings input to access the blueprint.

I also see this message appear in the output log each time the button is displayed on screen:

LogPlayerController: Error: InputMode:UIOnly - Attempting to focus Non-Focusable widget SObjectWidget [Widget.cpp(776)]!

I guess it has something to do with how quickly the button is ‘clicked’ after it’s created; so I imagine it may be that some process or check for the hover is being interrupted? I don’t know

I think the problem is because you lose focus, there a focus on widget function its name is Set Input Mode Gam and UI there a few of them check with one you need, you need to set it on a player controller.

Thank you.

I have the ‘set input mode UI only’ node in the character blueprint to run when the pause key is pressed, and the ‘set input mode game only’ node in the pause menu widget blueprint to run when the button is clicked. I moved the set input mode UI only node to the beginning of the character blueprint right after the pause key input is detected (instead of having it near the end of the execution path), and that seems to keep the error in the output log from appearing for the first time the game is paused, but it has appeared every subsequent pause until the game is reset. I tried some other things too but this is the only thing to me that seemed to help.

Here are screencaps of the blueprints:

Even though the error message is gone for the first pause, after testing I don’t think it has prevented the button clicking bug during that pause or for any other. I don’t know if they are related issues because of that, but it is nice to have at least one less error message. =)

I think you can fix most of the problems by having a hidden menu like most games do and not creating and removing the widgets on the fly. Create the widget once when the game starts from your player controller, then save its reference to the controller hide it and when you press escape or other buttons make the menu(widget) appear again. Widgets can hold other widgets so it’s really easy to create a menu with UE4 widget system and they can talk to each other through references so that makes it even more easier to work with.