Search in
Sort by:

Question Status:

Search help

  • Simple searches use one or more words. Separate the words with spaces (cat dog) to search cat,dog or both. Separate the words with plus signs (cat +dog) to search for items that may contain cat but must contain dog.
  • You can further refine your search on the search results page, where you can search by keywords, author, topic. These can be combined with each other. Examples
    • cat dog --matches anything with cat,dog or both
    • cat +dog --searches for cat +dog where dog is a mandatory term
    • cat -dog -- searches for cat excluding any result containing dog
    • [cats] —will restrict your search to results with topic named "cats"
    • [cats] [dogs] —will restrict your search to results with both topics, "cats", and "dogs"

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. alt text

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. alt text

  • 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!

Product Version: Not Selected
more ▼

asked Apr 15 '15 at 12:10 PM in Blueprint Scripting

avatar image

16 6 9 12

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

1 answer: sort voted first

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.

more ▼

answered Apr 15 '15 at 01:06 PM

avatar image

DG Gage
1.7k 62 31 129

avatar image Aian Apr 15 '15 at 01:35 PM

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

alt text

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?

avatar image DG Gage Apr 15 '15 at 03:15 PM

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?

avatar image Aian Apr 15 '15 at 03:54 PM

I think I have explained wrong, sorry.

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

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

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

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. alt text

I hope its clearer now, and thanks again!

avatar image DG Gage Apr 16 '15 at 12:07 AM

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.

avatar image Aian Apr 16 '15 at 02:09 AM

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. alt text

alt text

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.

alt text

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

avatar image DG Gage Apr 18 '15 at 05:35 PM

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

avatar image Aian Apr 20 '15 at 06:27 AM

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?

alt text

alt text

(comments are locked)
10|2000 characters needed characters left
Viewable by all users
Your answer
toggle preview:

Up to 5 attachments (including images) can be used with a maximum of 5.2 MB each and 5.2 MB total.

Follow this question

Once you sign in you will be able to subscribe for any updates here

Answers to this question