Blueprint Macro Library
Direct Blueprint Communications
How to Set Up Inputs in Blueprints
Blueprint Interfaces allow one Blueprint to trigger an event or function in another Blueprint. Both of these Blueprints must implement the Blueprint Interface in their Blueprint Properties.
In this example, the BP_Button Blueprint causes the gears in the BP_Gears Blueprint to start or stop spinning.
There are two separate Blueprints here: A button Blueprint with a box component to use as a trigger, and a Blueprint made up of a collection of gears that will start rotating while the button is pressed. A third asset, a Blueprint Interface, is employed as a means of sending information from one Blueprint to another.
Click for full size or right-click and Save As.
Shape components can either be a box, a capsule, or a sphere, and are simple shapes used primarily for collision detection. The box component in BP_Button is set to only overlap Pawns, so the OnComponentBeginOverlap event in the script will only fire when a Pawn overlaps the box.
The Toggle interface message nodes have the Target Blueprint Actor variable connected to their Target pins. The Target Blueprint variable is public, and set to BP_Gears for the instance of the button placed in the level. These interface message nodes execute the Toggle event present in the BP_Gears Blueprint as a result.
The gears Blueprint implements the interface in the form of a special Toggle interface event, connected to nodes that causes the gear Static Mesh Components to stop and start turning. This event is triggered by the Toggle interface message nodes in BP_Button.
Interface variables - The interface event employed by these Blueprints also outputs a bool variable, which is used to tell the gears Blueprint whether it should stop or start turning when the interface event is fired. Interfaces can also return variables to the Blueprint that called the event, which can be useful for passing information back and forth between Blueprints in both directions.
In those cases, however, the implementation in the Target Blueprint is done with functions instead of events.