Download

Call Custom Event !

Hi,
I have Widget Blueprint, inside it i created Custom Event called Update Material, How can I call Custom Event inside Level Blueprint ?

Event Dispatchers are meant for that. And you doing it opposite way to what is needed.

Create event dispatcher in Level Blueprint.

In widget create cast to level blueprint node. (That part i am not sure if its possible, I avoided casting to level because all scripts go to Kansas when new level is loaded, so much of redundant code is needed.)

Then from blue cast pin drag line and type “Assign to” pick event dispatcher you just created (it should be in list, but never did it with level BP, so not sure)

Now whatever you call “Event dispatcher” inside Level Blueprint it will execute code that is connected to Assign node in widget.

But generally better way is doing all that dispatchers in player controller, or some blueprint that you drop into level. Everything can find reference to player controller or player pawn, and code inside survives level load, so it is only in one place instead of every single level.

But if you really want it your way:
create FUNCTION inside of your widget
make that widget variable, read its reference and store somewhere (or expose in hud\UMG, so other bp can read it)
then in level blueprint, cast to player controller, get hud reference, cast to hud and read reference to widget
When you have that, cast to widget, and call that function.
Yes more casting this way than with dispatchers.

https://youtube.com/watch?v=z4Xv_WNxpIE

Try that tutorial i did on for size.

It explains in some detail how to communicate using Event Dispatchers.