Event dispatcher from UMG to Actor BP?

Hello everyone,

I have my UMG widget (my_menu3) and I want my button to start my custom event located in an Actor Blueprint.

So :
1 - I created a Event dispatcher (changemesados) in my widget for when I’m pressing this button.

http://a.pomf.se/cdgtri.jpg

2 - In my Actor blueprint I create a Cast to my_menu3 node and Bind my event dispatcher to it. (I convert it to pure cast, if not, it gives me an error when compiling)

3 - I link the event dispatcher to my Custom Event (phonecall) and set my event dispatcher to Event Begin Play. So this way is always enabled when I play the level.

http://a.pomf.se/liwqha.jpg

    • I tried using a Create Widget node, but this brings the widget to the screen and I dont want that, I already have an Input for making it to appear.

Sadly it doesnt work. It compiles fine, but it does nothing. Am I missing something? Ive been trying to figure out this issue by changing my methods, but no luck.

Thanks in advance!

This should work if you just use your widget variable to access the dispatcher rather than that cast node. So once you do Create Widget, I’m guessing you are then saving the result as My Menu 3?

Right after Create Widget, you would use that resulting output or that new variable (same thing) and establish the dispatch connection in your actor BP. So, you wouldn’t do this on Begin Play, but rather wait until the widget is created so you can reference its instance.

Casting to widgets seems to be weird. But using the variable you get from creating them works just fine.

Thank you for answering,
I think I created what you said here :

http://a.pomf.se/jncuef.jpg

The question now is,
My widget appears when I press SpaceBar. I have that in my Level Blueprint.
How can I let my Actor BP starts after the widget is enabled?

Do I have to create another Event dispatcher from the Level Blueprint? So it knows when I press the SpaceBar button?

I’m a bit confused now, but your setup there looks good for the purpose of binding that event from your widget.

So you’re creating the widget from the level BP by pressing spacebar? I guess what I need from you is the actual order of events here. What is happening, how should it happen, and when does it need to happen?

I think I have explained wrong, sorry.

1 - This is my level blueprint, when I press SpaceBar it flipflops the widget.

http://a.pomf.se/bfvmul.jpg

2 - My widget blueprint, just a button and a event dispatcher.

http://a.pomf.se/hppavg.jpg

3 - My actor blueprint, how can I make it work only once my widget is enabled?

http://a.pomf.se/zxdvsi.jpg

I tried adding to my Level BP the Actor BP nodes and it works fine, but it would be too messy as I want to have 10+ different Actors.

http://a.pomf.se/rxkbis.jpg

I hope its clearer now, and thanks again!

Thanks for the clarity!

First, you should consider the creation of the widget and establishment of its event dispatchers as actions that need to happen before the player starts interacting with it. You want the system in place before you start playing with it.

You can probably set this up on Begin Play. Create the widget, and save its output as a variable. Right after that, bind your event to widget’s event dispatcher.

Now you’re ready to use your system.

What you should be doing on flip flop is quite simply toggling the visibility of the entire widget. For the very first time SpaceBar is pressed, you can have a Sequence with a DoOnce on the first pin that takes your widget variable and uses Add to Viewport. The second pin would be your normal business. This establishes your widget to the viewport once, and from there you will be toggling its visibility.

You can drag out from your widget variable and use Set Visibility to toggle it as Visible or Hidden. That will also prevent its button from being pressed, with seems to be what you are looking for.

Try that out and lemme know if you run into any problems.

Thank you again for your time DG Gage,
I followed your steps and I’m afraid I’m still stuck. These are my screenshots, I explain each of them in the image.
I tried putting the nodes you said but I’m sure I did it wrong.

http://a.pomf.se/zjgbkk.jpg

http://a.pomf.se/qexbdh.jpg

Anyway, I kept trying and found a way to make it work but only inside the level BP. I’m sure its a dirtier code but at least it works. It takes a lot of time for making just a single button though. I think I’ll try to keep it all inside the level BP as I can’t find a way to make it through the actor BP.

http://a.pomf.se/hjwtxd.jpg

Is there any way to use these bunch of nodes in the actor BP or making it easier?

Like I said, you’ll want to establish all the event bindings before using the widget. So as a single event on Begin Play or something like that, you’d create the widget, save it as a variable, and bind any events that’ll come from its use.

So get that set up and we can move forward from there

Sorry, but I dont really get it.
If I StartBeginPlay → Create widget → Create all the event dispatchers, when I start playing the game it would automatically create the widget onscreen instead of toggling it manually. Do I have to do this on another blueprint? I’m working just on level BP.

Can you show me an example where the bindings are created first and then all the system for making them available?

http://a.pomf.se/oedqtf.jpg

http://a.pomf.se/bqnxba.jpg