Creating Macros

To create Macros, use the My Blueprint panel and click the + button in the Macros category. The following screenshot shows the My Blueprint panel with a Macro named SetupNewWave:

The attributes of a Macro are displayed in the Details panel. In this panel, you can define input and output parameters. Input parameters are values passed to Macros/Functions. Output parameters are values returned from Macros/Functions. The following screenshot shows the Details panel of the SetupNewWave Macro with two input parameters and one output parameter. In Macros, the execution pins are defined as parameters:

The following screenshot shows the contents of the SetupNewWave Macro. The idea of this Macro is to set some variables for the next wave of enemies in a game. It receives the current WaveNumber as an input parameter, stores this value in the Current Wave variable, and determines the number of enemies by multiplying the current Wave Number by 5:

To add the Macro to Event Graph, drag the name of the Macro from the My Blueprint panel and drop it in Event Graph, or look for it in Context Menu. When the Macro is executed, the Actions that are in it will be executed. The following screenshot shows the SetupNewWave Macro being called in Event BeginPlay with a value of 1 in the Wave Number input parameter:

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset