Download

Event Dispatcher/Gameplay Framework Best Practices Question

Hello!

I´m creating an Event Dispatcher to notify all the elements of my game that the game started. However, I would like to know where is the best place for the Event Dipatcher… inside the Player Controller or Game Mode?

Right know, each element binds itself to the Event (which is inside the Player Controller) on the Begin Play call. Is it correct?

Cheers,

Daniel

Not sure it matters if it’s single-player.

If multiplayer, definitely in the GameMode, or else the event will be called once for every player in the game.

An alternative could be to create a BP Interface and implement the interface on all classes that need to know when the game starts. Then use Get All Actors with Interface in your GameMode to call the appropriate interface function on begin play. This assumes all your “listeners” are Actors, though. One advantage is that the “listening” actors don’t need a reference to the GameMode (or specifically, an instance of your custom GameMode class), which you otherwise need for event binding.

Thank you very much :slight_smile: