Event Dispatcher only firing on self

Hi,
So I’m working on a vendor system and I wanted to grey out and make some of the text red when the player cannot afford the item. Each item is in a slot and fills up a grid in another widget. I made a dispatcher and binded an event to check the player’s price and update the opacity and colors of the slot. The problem is that it only updates the slot that the player recently clicked on because I fire the dispatcher each time a payment is made. Any ideas as to why this is happening?


The second image shows the binding off the pre construct

1 Like

You’re making a call on a blueprint interface. That will not trigger a dispatcher.

Also, no point in using an interface for the object to talk to itself.

In fact, if it’s all happening inside the same widget, just use a custom event :slight_smile:

So that’s what I was wondering. If I use a custom event, how do I make sure that the slot itself and all of its “siblings” also run that event?

1 Like

Ah, now that’s different :slight_smile:

If you want a kind of ‘all siblings triggered’ scenario, then you need a custom event in the main widget, which each of the siblings binds to on construct.

Does binding them on construct in their own class not work? Because when I stepped through the code, they were all binded. But when I click the button to by an item, only the button that was clicked runs the dispatcher and the siblins aren’t triggered even though they are bound to the event

To bind, the object they’re binding to needs to exist at that time. Is that the case?

Hmm ok, I think I see what you’re saying. It creates a widget each time so I guess some of them don’t exist yet to be able to bind.

1 Like

You could just use ‘get all widgets of class’ to find them and just send the signal to all of them, from the custom event.

It’s absolutely fine with a few buttons, people get neurotic about not using ‘get’ nodes, but they’re fine in this sort of case. Even just for testing…

That makes sense. I had that idea in the back of my head. But I was hoping there would be a cleaner way or more performant way with dispatchers.

1 Like

Trouble is with dispatchers, you have to bind every time. That’s probably as bad as using ‘get’ :slight_smile:

Well I guess as long as it works, that’s what matters haha.

1 Like


When I run this get all widgets of class, the outputted array is of size 0. I’m creating the widgets and adding them to a grid slot. Are those not counted as widgets in that node? They are being displayed but that node get all widgets of class isn’t finding any widgets of that class.

I can get it to work by doing this but I wasn’t sure if casting would be the best way of doing this. Maybe I could use a blueprint interface as well but I wanted to see if you had any other ideas before I just take that route lol

1 Like

Yes, you could try an interface instead of casting here. That would be worthwhile, because the child widgets are generic at this point :slight_smile:

1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.