Macros

Collapsed networks of nodes that can be executed, or called, from another graph.

Choose your operating system:

Windows

macOS

Linux

Blueprint Macros , or Macros , are essentially the same as collapsed graphs of nodes. They have an entry point and exit point designated by tunnel nodes. Each tunnel can have any number of execution or data pins which are visible on the macro node when used in other Blueprints and graphs.

Creating a Blueprint Macro

Blueprint Macros can be created within a Blueprint Class or Level Blueprint, just like Blueprint Functions. They can also be organized into Blueprint Macro Libraries.

To create a Blueprint Macro inside a Blueprint Class, Level Blueprint, or Blueprint Macro Library:

  1. In the My Blueprint tab create a new macro, by clicking on the Add Button plus_Button.png on the macros list header myblueprint_macro.png .

  2. Enter a name for your Blueprint Macro.

    name_macro_blueprint.png

Your Blueprint Macro will open in a new tab in the Graph tab of the Blueprint Editor.

You can also create a Blueprint Macro by Right-clicking in the My Blueprint tab and selecting Macro .

add_macro_rtclick.png

Building a Blueprint Macro

When you first create a Blueprint Macro, a new graph will open containing an Inputs tunnel node and an Outputs tunnel node.

input_output_macro.png

In the Details pane for your Blueprint Macro, you can add input and output execution and data pins. You can also set the Description , Category , and Instance Color of your Blueprint Macro.

new_macro_details.png

To add input or output parameters:

  1. Click on the New button in either the Inputs or Outputs section of the Details pane.

  2. Name the new parameter and set its type using the dropdown menu. In this example, there is an Integer data input parameter named Score , an input execution pin named Test , and two output execution pins named Win and Lose .

    macro_details.png

    The tunnel nodes in the Blueprint Macro graph will automatically update with the correct pins.

    macro_tunnels_with_pins.png

  3. You can also set a default value by expanding the entry for the parameter.

    macro_details_expanded.png

To change the location of the pin for this parameter on the edge of the node, use the up and down arrows in the expanded Details pane entry.

To give your Blueprint Macro some functionality, connect data and execution wires to the pins of your Inputs and Outputs tunnel nodes and create a network between them.

score_comparison_example_macro.png

This example Blueprint Macro checks if the score that is input into the Macro is greater than the necessary score for winning, and then triggers different output execution flows depending on the result of the comparison. Note here that the Test and Score pins were flipped using the up and down arrows in the Details pane, to avoid wires crossing in the Blueprint Macro graph.

move_pin_arrows.png

Unlike Functions, Macros can have more than one output execution pin, so you can have execution flow like this where different output execution pins are activated depending on the results of graph logic. Also, you could have a Macro with no execution pins that only manipulates data, as long as the nodes within the Macro are not execution nodes.

data_macro.png

Implementing Macros

There are several ways to add a Macro node to another Blueprint graph. Like Function nodes and Custom Event Call nodes, it is possible to add multiple copies of Macro nodes throughout the graphs in your Blueprint.

To add a Macro, Right-click in the graph and select the Macro in the context menu that appears.

right_click_add_macro.png

You can also drag and drop off the pin of another node, and the Macro will appear in the context menu if it has a parameter pin of the corresponding variable type and flow direction.

pin_macro_summon.png

Alternatively, you can drag the Macro from the My Blueprint tab and drop it in the graph.

macro_drag_1.png

Once the Macro node has been added to the graph, it behaves like any other node and the input and output pins can be wired accordingly. Double-clicking on a Macro node will open the Macro's graph.

Help shape the future of Unreal Engine documentation! Tell us how we're doing so we can serve you better.
Take our survey
Dismiss