Widget. On clicked event for button is not working.

I have a widget BP. When the game starts this widget BP is added to the viewport. Inside widget BP I have a button, background image and text. When I click the button it adds 5 to the text (score). If I click anywhere instead of button from the beggining of the game I won’t be able to click on button again (it won’t do anything). How can I change it that if I accidently click anywhere instead of the button I can then click the button and it will work?

Thats because at the begin, you’re not in the game (you cant walk, and so on).

You need to get the mouse cursor, see the docs for more (you need the “Set Input Mode and Show Cursor” Section).

Using “SetInputModeAndGameUI” in your BP should solve the problem

Thank you very much! That works.