Best Practices for Passing Button On Click Event to Player Pawn (Event Dispatcher or Object Reference?)

Patrick Dougherty
Fri, 05 Jan 2024 16:54:18 +0000
Programming & Scripting

Hi all!

I am making a small management-style game where you place buildings. I want a menu to initiate the ability to place buildings, so I want to pass a button click event from my HUD (which I created and overrode in my Game Mode) to the Player Pawn.

I was able to pass an event by binding an event dispatcher but it feels like a lot of heavy lifting for communication between just two blueprints (I don’t think I will need more than one blueprint to listen for this click event).

Here is my work-in-progress, does anyone have any suggestions for a better setup?

Is it better to just have an object reference to the button itself instead of an event dispatcher? I am hesitant to do so much work on Begin Play. Would I have to do this for every button?

Thanks for any help!

7 posts - 3 participants