This page covers using Direct Blueprint Communication to communicate between two Blueprints and pass information between them.
For this example we will allow the player to pass through a box and communicate with and activate a particle effect.
For this guide we are using the Blueprint Third Person template with Starter Content enabled.
In the Content Browser, open the Content/StarterContent/Shapes folder.
Right-click on the Shape_Cube, then under Asset Actions, choose Create Blueprint Using This...
Click Ok at the confirmation box that appears to create the Blueprint.
Inside the Shape_Cube Blueprint, select the Static Mesh in the Components window in the upper-left.
In the Details panel, change the Collision Presets to OverlapOnlyPawn.
This will ensure that only the Pawns and by extension Characters can pass through the box.
In the MyBlueprint window, click the Add Variable button and name the variable TargetBlueprint.
This will be the other Blueprint that we want to directly communicate with.
In the Details panel for the variable, set Variable Type to Blueprint_Effect_Fire and make it Editable.
Here we set the Blueprint that we want to communicate with and made the variable publicly editable (editable outside this Blueprint).
Select the Static Mesh in the My Blueprint window, then in the Details panel, add an On Component Begin Overlap Event.
This will add a node and open the Event Graph where we can provide the script that occurs when entering the cube.
Drag off the Target Blueprint and Get P Fire and Get Fire Audio, then connect as shown to an Activate node.
Here we are accessing the Particle Effect and Audio components inside our Target Blueprint and Activating them.
In the Content Browser under Blueprints, drag the Shape_Cube Blueprint into the level.
In the Content Browser under Content/StarterContent/Blueprints, open the Blueprint_Effect_Fire Blueprint.
In the Components window, select P_Fire then in the Details panel un-check Auto Activate.
We do not want this effect to auto activate as we will tell it to activate when entering the box in our level.
Drag the Blueprint_Effect_Fire Blueprint into the level.
Select the Shape_Cube Blueprint then in the Details panel, use the drop-down to select the Blueprint_Effect_Fire Blueprint.
Here we are specifying the instance of the Blueprint_Effect_Fire Blueprint in the level that we want to communicate with. If we have placed several instances of the Blueprint_Effect_Fire Blueprint in the level, each of the instances would be displayed inside the drop-down menu allowing us to indicate which instance is the Target Blueprint to communicate with.
Clicking the Eye Dropper icon allows you to select the instance of your Target Bluperint inside the level instead of using the drop-down menu. Remember, you can only select Blueprints to target based on the variable type you have specified.
Click the Play button to play in the editor and test running through the box with the character.
You will see that once the character enters the box, the fire effect will be activated inside the level. You can use Direct Blueprint Communication to not only change the properties of a Blueprint from inside another Blueprint, but you can also pass the values of Variables, call Functions or Events, or anything else that the Blueprint would otherwise normally be able to do.