Fire event in Level Blueprint from Widget

Good, your widget is working. Now, your issue is on your level blueprint, and that casting was incorrect.

Footage of what I actually have

My level Bp:


At the start of the game i get “disp apres”, so it goes through the “bind event” node

btw idk why i should “create” the widget because it is already a placed actor in the level

1 Like

You’ve figured that out. Your widget is a component of an existing actor in the level. So, you need to retrieve the widget reference from that actor and bind the event dispatcher from it.

with a cast ?

sorry If I ask dumb questions, Its been only 2 weeks I am working with UE5 and english isn’t my native language

how am I suppose to do that ?

Click on that actor while in editor, and go the level blueprint and right click, and you should see something like “create a reference to …”

Then, get component by class, select widget interaction component and bind event to your test dispatcher. Connect to your level bp begin play.

forgot about that, sorry.
but with this reference it looks like i can’t bind it to the event dispatcher

edit: doesn’t work with “widget componement” either

In this case, you need to cast. From get component by class, cast to your IWB_… and try again.

I get a “the cast will always fail”

You’re almost there.
Let me search how to proper reference a widget interaction and I’ll share here.

thank you very much for helping me :slight_smile:

Hi there,

I am not sure how to reference an interaction widget, perhaps you should experiment with these nodes below. Also, you may need to change the parent class of your widget, from UserWidget to InteractionWidget.

If that doesn’t work, you may want to revert your widget to user widget and go from there. This is how you want to reference a User Widget
image

Unfortunately, I can’t find a documented way to reference this type of interaction widget. Let’s see what other devs would recommend.

1 Like

I do not have the option “cast to interactionWidget”, and when I try to change the parent of my widget I do not have the option to change to a InteractionWidget

For the second Image are you in level BP ? I can’t get the reference of my Widget

I found out the solution. You just have to create a Game Mode with a event Dispatcher and use “get game mode” > “cast to (your GM)” and then call or bind your event

3 Likes

you can also make a variable and set it’s type to WIDGET>OBJECT reference. and connect.
should work just fine
Screenshot (12)