Make an event disptacher in GameMode which activates on Confirm_Button from Widget

Good day, friends!

I want to create an event dispatcher or somehow to communicate to GameMode that Confirm_Button in my widget was clicked and to spawn the actors with the variables introduced in widget.

These are the nodes from GameMode

These are the nodes from Confirm_Button widget

Until now, the Main_Menu widget (with the Confirm_Button) was placed in a diferent starting level and OnConfirm would start the Level with it’s logic.

Now I want to leave only one level and for the Widget to be fixed all the time on Viewport (I’ll figure this out).

Only now I can’t make it work as I don’t know how to tell the GameMode to wait until Confirm_Button is clicked and only after then start working.

Maybe my logic is flawed and I can implement this differently but I would need your help in deciding on that.

Thank you in advance for your help!

  • a Custom Event in the Game Mode BP, waiting to be called:

image

  • in the widget, the Confirm button will call an Event Dispatcher and trigger the Custom Event in the Game Mode:

The above is the gist.


spawn the actors with the variables introduced in widget.

To expand on this, you can add data pins to the Custom Event and the Dispatcher:

  • in the GM, the Custom Event has an additional pin:

  • in the widget:

This way you can send any data from the Widget to the Game Mode, and only once the button has been pressed.

1 Like

Thank you very much, @Everynone !

It helped.

The last part wasn’t needed though as the spawn logic was in other funtions and it works great as it is.

1 Like

You can also bind it directly to a function, it does not need to be a custom event!

Good luck.

1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.