Event Dispatcher not working after widget restarts

Hi everyone! I’m very new to BP - please, be patient))) So, my problem is…

I have a widget that starts with the level and have some buttons. Some of them have a BP code inside same widget event graph (check example on attached image). And others are calling Event Dispatchers (in level blueprint).

First launch of the widget - everything works fine till this widget is closed (remove from parent). When widget fires again all buttons with Event Dispatcher are not working. No problems with other buttons - everything works well.

What I’m doing wrong? Any ideas?

Thanks!

I dont know but I think maybe the Bind Event needs to be called again and make sure the HUD reference points to the current widget and not the destroyed one.
I am new to event dispatchers too. Try my idea and let me know if it helped.

Thanks for reply! But I’m not sure how to implement that((( As I told - I’m noob in BP…

Generally that’s a point - how to tell to Dispatcher to work with restarted widget? I’ve tried Event Tick to make it work, but with no success.

Maybe there are other ways to avoid using Dispatcher at all? Is there any option to get reference of the static meshes/cameras at widget event graph? As I understand it can’t be done. Hopefully I’m mistaken)))

No you can totally get those. It’s not very performant and there are better ways than this but it’s better than doing the same thing every Tick instead of being event driven :slight_smile:
What you can do is use the GetAllActorsOfClass node, loop through the array it returns until you find the actor you want, then grab its Static mesh. Then the trick is knowing which one of those actors is the right one. You’ll have to identify it uniquely using its playercontroller or a Tag or a variable that is always set to something different, or something.

It’s not the best way to do things but it works.

Thanks again! I can understand the logic of your advises, but not sure how to implement them in BP. Sadly, but i have to dig deeper into basics of the nodes and how to use them properly.

BUT! After a long break I found a very simple solution and it works fine for me (at least for now).

All is needed is to keep widget(main UI) with dispatchers “alive”. So, as it loaded first time - dispatcher started and works, than button push runs another widget on top of main UI and simply disables it’s visibility, but not remove from parent. When new widget is closed - main UI is set visible again and that’s it!