Direct Blueprint Communication

Choose your OS:

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.

  1. In the Content Browser, open the Content/StarterContent/Shapes folder.

  2. Right-click on the Shape_Cube, then under Asset Actions, choose Create Blueprint Using This...

    DirectCom1.png

    Click Ok at the confirmation box that appears to create the Blueprint.

  3. Inside the Shape_Cube Blueprint, select the Static Mesh in the Components window in the upper-left.

  4. In the Details panel, change the Collision Presets to OverlapOnlyPawn.

    DirectCom2.png

    This will ensure that only the Pawns and by extension Characters can pass through the box.

  5. In the MyBlueprint window, click the Add Variable button and name the variable TargetBlueprint.

    DirectCom3.png

    This will be the other Blueprint that we want to directly communicate with.

  6. In the Details panel for the variable, set Variable Type to Blueprint_Effect_Fire and make it Editable.

    DirectCom4.png

    Here we set the Blueprint that we want to communicate with and made the variable publicly editable (editable outside this Blueprint).

  7. Select the Static Mesh in the My Blueprint window, then in the Details panel, add an On Component Begin Overlap Event.

    DirectCom8.png

    This will add a node and open the Event Graph where we can provide the script that occurs when entering the cube.

  8. Drag off the Target Blueprint and Get P Fire and Get Fire Audio, then connect as shown to an Activate node.

    DirectCom10.png

    Here we are accessing the Particle Effect and Audio components inside our Target Blueprint and Activating them.

  9. In the Content Browser under Blueprints, drag the Shape_Cube Blueprint into the level.

    DirectCom5.png

  10. In the Content Browser under Content/StarterContent/Blueprints, open the Blueprint_Effect_Fire Blueprint.

  11. In the Components window, select P_Fire then in the Details panel un-check Auto Activate.

    DirectCom6.png

    We do not want this effect to auto activate as we will tell it to activate when entering the box in our level.

  12. Drag the Blueprint_Effect_Fire Blueprint into the level.

  13. Select the Shape_Cube Blueprint then in the Details panel, use the drop-down to select the Blueprint_Effect_Fire Blueprint.

    DirectCom7.png

    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.

  14. 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.

Tags