Event Dispatchers still confuse me : help?

Hi All,

I’m sorry i’m asking for help a lot lately it seems. I’ve done so much great progress on my game, that I’ve moved ahead to making my menus (UMG) and now I’m trying to integrate my menus with my main Blueprint Level where i have scripts that generate things that are specified by the user, and also employs my saveGame based on the user name, and file preference info.

here’s the rub. I can’t figure out how UE4 is supposed to communicate between blueprints still (especially UMG).

I have used Event Dispatchers, but they are connected to a class that is in my scene that I can easily use as a target, and then pass the event on correctly, however I am stumped trying to get the UMG’s script to pass a button press (and associated variables i am collecting like the player name and other info) to my Level Blueprint.

I’m not sure if I’m just too right brained (visual) to understand how Epic is using this system, it is agonizing for me to use when I’m used to programming languages where I can make a “global” call to an event or a function that I have in another script. Why is this so difficult? It is the singular thing that slows down my development more than anything… talking and passing info between blueprint scripts.

any direction on good tutorials or sample blueprints would be helpful

thanks

Check out this tutorial i did sometime ago. It deals directly with Event Dispatchers in communicating with Widgets and Blueprints.

Any questions or concerns, let me know.

In addition to watching DevilsD’s video (which I very much thank you for Devil, as it helped me out a ton when I was struggling with event dispatchers in a few aspects), I would suggest trying to use a struct in tandem with the event dispatchers. Reason being, structs are pretty much accessible by everything, and can hold pretty much any info you want them to. So accessing that info on your level blueprint (break struct), and even setting it (make struct) will be fairly straight forward. If you knew about all this already, my bad, just was throwing the suggestion out there in case you were not aware! :slight_smile:

PS: I’m also very right brained at times considering I came from a background of music, but you can easily get past all of that by just studying every chance you get, and practicing what you learn regularly. Don’t beat yourself up, and if you get stuck on something, theory craft your way through it.

Thank you so much for posting this. I was beginning to despair, and wondering how people get through the menu system now if there is little info on how it works.

But this gives me something to look forward to when i get into studio at 5:30am. I know I’m close to making this work, I have widgets working, i can set values I just need to do stuff with that information now…

looking forward to the tutorial.

Hi Sinarisinestro,

I appreciate that. The thing is I have made stuff like this before in other software, i still have note books of my process but I have the idea of how to get it to work.

I am however used to working with things that either work two ways. One is to save info (name of file, and the info ) into a file on disk, then access that and do what you need to do. That wouldn’t be too bad, except that I find writing out data to a simple text file is not straight forward.

The second way i’ve done this is using a sort of global function. In Unity for instance you could write a function, that would trigger a function in another script, and i’ve done this in other software too. This is a straight forward way of working, where you an access a global function, by simply appending the name of the function with the name of the script, and declaring the function as global if i remember right (it’s been awhile).

This use of events and dispatchers and binding and calling is so unclear, because it isn’t even clear where the bind, or where the call should be made, then what to do with that info when you get it.

I’m rambling now… complaining.

I know this will get easier when I go through all these different hurdles at least once, and I will definitely look at structs. That is exactly the kind of hint in the right direction that I need.

-finn

Glad you found it useful. A lot of people seem to like that tutorial, best one ive made so far i guess lol.

Hopefully it also helps you out @Finn

Definitely quite a good tutorial nice work. It’s something that can seem quite confusing since it is the 1 time where a node essentially flows backwards instead of forwards so it can be tricky to understand why that’s happening.

No problem! Glad to be of help. This community is honestly the best. Everyone is incredibly helpful here & awesome! So I try my best to pay it forward like everyone else.

Feel free to PM me if you ever get stuck on something and want a pair of second eyes, or just some advice on some theory crafting. I’m in love with UE4 and blueprinting, so I love talking “shop” so to speak haha.

It will get easier, key thing is to not get down on yourself about not understanding something right away, and making sure you just keep at it & don’t be afraid to take outside the box approaches. Practice makes “perfect”.

I agree, this community is super helpful. Also there is so much help offered soon after someone looks, that’s why when I can I start the day with just offering what I can to people who have even less experience than myself with UE4, or at least offering my broader vfx knowledge where I can. I wrote about my experience recently.

I wrote this in September when trying to write my save game system, here’s a quote

"Joel demonstrated something though that many people demonstrate on the Unreal forums and on youtube and other places, a willingness to grapple with the issues others have, and offer their help in resolving them.

So often we hear about the people who snipe on the web, and those who bully people, but Joel and others abound on the web. The community that shares in these videos help to create a sort of virtual game company, that shares information making a small team feel robust."

http://daevfinnstudio.com/unreal-4-save-game-peer-support/

Up now at the crack of dawn in my studio to go at this again, feeling bolstered by the community. thanks. -finn

Good luck! :slight_smile:

That tutorial is going to be helpful because I needed a way to communicate widget loadout changes back to my player controller, I haven’t tackled this part of UE4 yet

Hi DevilsD,

I went through your tutorial, and it’s very well done, well explained, and nicely paced all around. Although my setup is a little different it’s in the same vein so I hope I can get through this a little more.

The breakdown comes when you create the widgetPopup variable. You set this to a reference, by typing widget then choosing reference… but it seems to know what widget automatically that you are referencing. Mine does not.

So I can get a couple things to happen. I’ll show some images to show where it goes wrong.

9c80ab04adef21d89467d005618c676431a2cbbb.jpeg

I basically get lost when it comes to this setting of a variable, but the truth is it’s not the variable that is important. It is what goes into that Target of the BindEvent to CreateSolidLetters that is the issue. If the Set widgetPopup works correctly this should do it. amazing that something you casually did, should hold me up so hellishly… it’s hard for me to follow the logic of why I cannot get this to work, why is my call to the UMG i’m referencing not working, no matter how many ways I try to set that variable.

ugh, having trouble uploading the image, and we have flu bug in the house, barely slept last night. i’ll post this much and try to post the next image when I get back from checking on everyone.

okay, i flattened my second image and made it a png file instead hoping this works. I feel like i’m close with this, but again as i’m looking at it, it’s the target of the bind event that i cannot assign. Your video clarified that there needs to be a call back to the UMG widget so I created a variable, but so far i’m unclear why I can’t get it to assign to the target. My setup is definitely different overall, but I thought that setting a variable is setting a variable, so that the call should work.

Any ideas on why this is not working right would be helpful. I’m also just trying to get the first pass here, i.e. get the button to execute and just do something in the level blueprint (which is where I’m trying to execute the button press not in a class blueprint). This is important because I need to pass information to the level blueprint like the player’s name, the level name, a list of words they want to work on. (a teaching game for dyslexics is what I’m working on).

here is my unrelated but more information about the game i’m working on… or at least the inspiration.

http://daevfinnstudio.com/dyslexic-confessions-of-a-dad/

still at this, i’m somewhat exhausted after being up taking care of my wife and sons, but I keep doing research on why my UMG widgets will not communicate to my Level Blueprint, and just keep coming up with a dead end over and over again.

Ok so at 16:10 in my Video Tutorial i create the WidgetPopup variable. I set this variables type the same as my Widget itself. I noticed your widgetPOPUP variable type is not the same as your Widget that you created. You have 2 options, change your variable type to the same type that is your Widget or use a CastTo node to cast to the same type as your Widget before you attempt to use the widgetPOPUP variable to setup the Bind node.

Since your variable type isnt the same, your Event Dispatcher is “out of scope”, this is why you cant Bind to it correctly.

DevilsD,

Thanks, that cleared that up. I tried every variation and I wasn’t sure how you got that value in your widgetPOPUP to happen, It was in my head that when you did that, you were scanning for a class, not a specific blueprint.

It feels like i’m close for this to work, but the last thing that is happening is that oddly, my custom event will not connect to the bind event.

Error says " Delegate by ref is not compatible with delegate"

Usually it will just connect to that top event input for me (the red square)…

have you seen this before?

thanks for your help. I was knocking away at this while taking care of two kids and a flu riddle wife yesterday on a few hours of sleep. Feeling much more rested today.

oh wait… i think i see it. i’ll post an image

Okay, once I got the widgetPOPUP figured out this started to click a little faster. I still have some work to do on all this, but at least my UMG is talking to my Level Blueprint. (And by i figured it out, I mean DevilsD set me straight).

08e7369eaf9ca5c1e1de920f5fab71833c798bf5.jpeg

501a20f52394bf94e420e700587001c00e975f28.jpeg

okay I spoke too soon. It’s still giving me errors where the widgetPOPUP are concerned during game play, and doesn’t communicate still. sigh…

@DevilsD, your tutorial is great, really great. It’s just not a complete match for what I’m doing, as I have my menus already generated and just want to execute what is already there in the Level Blueprint. So I have to do a bit of taking and leaving. For instance you track the player, and whether you are in the collision zone of the door, but my overlay covers the entire game when the player is in the menu making choices, that are then executed in the Level Blueprint.

So i’m still getting an error concerning my widgetPOPUP. I stated to make sure I didn’t miss anything in the tutorial and I’ll comb through it again, but again I’m leaving things out because in this instance i’m not bringing up an isolated menu that is associated with something like a door (although now I really want to do that).

here’s the error below. It occurs to me that maybe the the widgetPOPUP needs a default value assigned, but it won’t actually let me assign anything. I don’t know if that is a clue or not. Still feeling like there is something I’m not getting. The widgetPOPUP is the target, I set the variable Type to my menu blueprint specifically, yet it’s still stopping here cold.

Error Accessed None ‘widgetPOPUP’ from node Bind Event to createSolidLETTERS in graph ‘EventGraph’ in blueprint A-challenge_1

Where you create your Widget is where you need to Bind to the Event Dispatchers (not technically true but you should). So if your Widget is created in the Level Blueprint you should be setting up your event bindings there.