Direct Blueprint Communications

Choose your OS:

Direct Blueprint Communication is the most common method of Blueprint Communication and is great for when you have two Blueprints that you know you want to have talk to each other at some point. This type of communication is always one-to-one; meaning one Blueprint (the "Working Blueprint") is requesting to access another Blueprint (the "Target Blueprint"). The simplest way to use Direct Blueprint Communication is to get a reference to the Target Blueprint through a publicly exposed object Variable and then specify which instance of that Blueprint you want to access.

General Workflow

The first thing that you will need to do in order to use Direct Blueprint Communication is to identify the Blueprints that will be communicating.

SelectedBlueprints.png

Above we have a Character Blueprint and a Ceiling Light Blueprint which we want the character to be able to turn off.

In this instance, the working Blueprint is our Character Blueprint and we are targeting the Ceiling Light Blueprint. Through Direct Blueprint Communication we can say that when the player character presses a button, target the Ceiling Light Blueprint and turn off the light. To do this we would need to create a publicly exposed variable inside our character Blueprint, targeting a Ceiling Light Blueprint.

TargetVariable.png

Above inside our Character Blueprint we have created a variable of the Blueprint Ceiling Light type and we've also set it to Editable which will allow us to set the instance of the light we want to affect in our level.

Be careful about which variables, functions, and events you expose. Do not expose variables unless it is safe for other people to access and change them. As a best-practice guideline, expose only what other Blueprints need and what you want level designers to be able to change, as opposed to exposing everything.

In our level with our Character Blueprint selected, we can see the new variable that we can then set from the Details panel.

NewVariableCreated.png

By default the variable is set to None and must be set to define which instance of the ceiling light you want to affect, as you could have multiple ceiling lights in your level and you need to define which one you want to communicate with. You can click the drop-down menu (or eye-dropper icon) to select from the level and specify which instance you want to communicate with.

SelectInstance.png

Since we only have one ceiling light in our level, only one is shown however if we had more they would be listed in the drop-down.

Once you define which instance you are going to directly communicate with, you will then be able to access that light's functionality, variables or other settings from inside your Character Blueprint.

For a more detailed walk-through, please see Blueprint How to for Direct Blueprint Communication .

Functions & Direct Blueprint Communication

When you are working with Functions in a Blueprint, you can still use Direct Blueprint Communication by specifying a target Blueprint type as a parameter for that function.

FunctionTarget.png

Above we have created a ToggleLight Function with an Input pin set to our Blueprint Ceiling Light.

When using a target Blueprint in a Function, you will need to still indicate which instance of the target you want to communicate with. This can be done using a publically exposed variable (below) or provided externally when you call this function.

ToggleLight.png

Above, when F is pressed, it calls a ToggleLight function with the Target being our publically exposed variable.

Troubleshooting

One common error occurs when no instance is specified at all in your variable. If you are having trouble getting the script from the target Blueprint to work when you call it from the working Blueprint, make sure that you have specified which Blueprint instance you want to use.

NoneSettings.png

If, instead, you have set the variable from the result of a function call, you should see a warning in your logs that your variable has an "Access None" exception. If you have the Message Log window up, it should provide a clickable link to the node that is causing the problem.

ErrorMessage.png

Above, a function has been called however the instance of the target Blueprint has not been specified which results in the Accessed None error. The error indicates the script that is causing the issue as well as the Blueprint the error occurs in. Clicking either will open the Blueprint that is causing the issue.

Tags