Communicating between Blueprint scripts and HUD

I’m struggling to understand how to get different blueprint scripts to communicate. I want to execute a custom event in my level’s main blueprint, and I want to execute it with my game menu.

So for instance right now I have two things that don’t communicate to my Level_Blueprint.

My Save game is in the Level_Blueprint, but the Save button is in my MAIN_MENU blueprint. How do i execute the Save_My_Game I made in my Level_Blueprint from here?

I also have a Start New Game. It’s really along the same lines, except that I want to execute a custom event that will set the isNewGame value back to true, and restart my game at the beginning.

I have done lots of programming in the past where i pass information between scripts, i’m confused about how this is supposed to work in UE4 with blueprints, and the documentation has not enlightened me, neither have the Blueprint_Communication samples in regards to passing this kind of information.

There is documentation but the information is vague at best. There is little information on how to actually share information between blueprints from what i can see, and more to the point from a blueprint to the Level_blueprint to be specific. This is somewhat frustrating because being able to speak between scripts is to my mind something that is expected, and should be somewhat straightforward but it is incredibly difficult to figure out how to make it happen with UE4’s blueprints. So in other words it is NOT intuitive in the least from what I can find out.

where for instance to event dispatchers go, the target or the working BP ? Do they communicate to custom-events? Why not if they don’t? How exactly is information sent? Call, bind, unbind, the words themselves are vague stabs at something.

There are two ways to make blueprints communicate with one another: casting and variables.

First the Casting. You should make a variable of the Widget type, which I assume is the type of the blueprint that Main_Menu is, if not, simply change it. The variable should be a reference to the widget.
ExampleBlueprintVariables.PNG

VariableValues.PNG

You can either create the Main_Menu widget here or elsewhere. You want to set the Main_Menu variable equal to the created widget. If you chose to create it elsewhere, you can use the techniques you learn here to help you get another blueprint to set the reference in this blueprint equal to what you created.

You then drag off of the Main Menu variable output and type in Cast to Main_Menu. What casting does is check whether or not the object being passed into the cast is a member or child of that class. In this case, we are checking to see if the widget we stored in the Main_Menu variable is a member of the Main_Menu class.

After that, you can then drag off of the output As Main Menu and type in the name of your function, in this case its called Save My Game. If a cast is successful, you can access any variables and functions in that class and manipulate it as you would if you were in that class’s blueprint. And thats how you would go about communicating between blueprints using casts.

However, there is an easier way using a more specific variable type. If we changed the variable type of Main_Menu directly to the Main_Menu class, we can access all of the variables and functions of Main_Menu by dragging off of the output of the variable instead.
OtherVariableType.PNG

ExampleBlueprintVariables.PNG

So yeah thats the basics on inter-blueprint communication. Using a more specific variable type is much quicker and is cleaner than having to recast objects multiple times to access their functions and variables but its not a one-size-fits-all solution like using a cast.