Event Dispatchers - I thought I knew how they worked

blindminds
Thu, 21 Dec 2023 17:04:29 +0000
Blueprint

I am trying to setup a Multiplayer System, with communication between Multiplayer Widget System, HUD and Game Instance and I am not able to get it working. I have used event dispatchers before, so thought I knew what I was doing but not understanding why what I am doing is not working.

I have a multiplayer widget system, where I have a base WBP_Multiplayer class that ALL of the widgets that are involved with the Multiplayer GUI System are children of. I also handle in the WBP_Multiplayer base class, binding all of the custom events to associated Event Dispatchers on the HUD_UI_MP blueprint.

On the Child Widgets, I then tried to override the parent events that were bound to the HUD_UI_MP event dispatcher, so that when the Dispatcher is called from the HUD_UI_MP, it should trigger the custom event bound to the dispatcher, and the child widget of parent class of MP_Multiplayer, would execute code specific to that Widget when the dispatcher is called.

I did this, so that I could make sure all the widgets have the same custom events available to them, as well as a few functions which could then be overridden in the specific widget.

I have a HUD_UI_MP blueprint that is child of HUD. This is where I handle communication between Widgets, HUD and Game Instance (GI_Multiplayer, child of GameInstance). HUD_UI_MP has all of the event dispatchers on it (ED_Login; ED_Login_Successful; ED_Disable_Login; ED_Logout; ED_Logout_Successful; ED_Disable_Login)

If I attach code directly to the event bound to event dispatcher on parent blueprint WBP_Multiplayer, it will execute that code for each instance, but if I have no code linked in parent to the event bound to event dispatcher, and then try to override parent bound event in the child widget blueprint class, no code will execute.

I have even tried calling a function in the parent widget class WBP_Multplayer from the event bound to event dispatcher, and then overriding the function in the child widget class, and no code will execute.

Should this not work like this?

I have also tried putting the event dispatchers in the WBP_Multiplayer parent class. And I have also tried putting the event dispatchers in my WBP_Sessions class which is a child class of WBP_Multiplayer, and calling the event dispatchers on the WBP_Sessions Class from the HUD_UI_MP blueprint. I have also tried casting to WBP_Multiplayer from WBP_Sessions and calling the dispatcher there and still did not work.

At this point I am dumbfounded and ready to give up. I though I had a thorough understanding of how dispatchers worked, and have used it before with great success, but like 2 years ago.

HUD_UI_MP → Show Sessions Widget (Called on HUD_UI_MP BeginPlay Event)

HUD_UI_MP → Login Custom Event Call

WBP_Multiplayer

WBP_Login (Child of WBP_Multiplayer)

WBP_Sessions (Child of WBP_Multiplayer)

Result Output

There should be a bright green print string with Worked! prnted…and nothing

I was trying to set this up so that all the widgets will update using each of their own custom code for that particular event (Disabling Login Button on WBP_Login for example, after login.

Any thoughts on this? Am I remembering how to use dispatchers incorrectly?

11 posts - 3 participants