How Can I Click the Widget Button in CHARACTER?

I added a widget inside my blueprint character. This widget contains a button. How can I press this button in-game just like a normal widget?

You can use the “OnClicked” event of the button. Here’s an example of how you can set this up:

  1. In your Blueprint character, add a reference to the widget containing the button by using the Add Component node and selecting “Widget.”
  2. Drag out a “Cast To” node and connect it to the output of the “Add Component” node. Use this node to cast the widget component to the specific class of the widget containing the button.
  3. Now you can access the button inside the widget by using the “Get Child” node to get the button from the widget.
  4. Drag out an “OnClicked” event from the button and add the logic you want to execute when the button is clicked.

Another approach is to use the “BindEvent” node to bind the button’s event to a function in the Blueprint character, and then you can use the Input Actions node to call the function from the input events.

In the controller you can set the cursor visibility to true. However, I assume you’ve already done this! :slight_smile:

Hello, first of all thank you so much. I couldn’t quite understand even though you wrote so clearly. I’m doing something wrong somewhere, but I can’t find it. Can you show it as a photo?

No worries!

Do you wish to press the button with the mouse?

1 Like

Yes, I wish to do this!