BP Eventdispatcher and Get all widgets of class

Hi. I’m still at the beginning and I search about eventdispatcher and get all widgets of class a few days because I wanted to comunicate between widgets.
First I’ve used eventdispatcher to comunicate between two widgets and after that I use the other solution ( get all widgets of class ) to comunicate between level bp and a widget. Maybe I’m making a confusion here, but can someone tell me what is the difference? It’s about performance? Or why shouldn’t I use only get all widgets of class? For me this is the easiest solution to trigger an event inside a widget. Or this two are different? Still can’t figure out what should I use!
Thank you!

When you use an EventDispatcher, the message is broadcasted to every object and only handled by those listening for it.

When you use GetAllWidgetsOfClass, you’re getting every widget and then only those of that specific class get returned in an array.

Here’s the main problem: Widgets don’t get destroyed when you remove from parent.

So, if you create a widget and then remove it and create it again, you now have 2 versions of that widget, both of which will get returned by GetAllWidgetsOfClass.

A widget that has been removed from parent will only be destroyed when GC kicks in.

If you use events, you can unbind events from a widget that gets removed from a parent, making sure that particular widget will no longer be receiving broadcasts and do things behind the scenes, without your knowledge.

Thank you very much! I understand now!