unreal-engine4

Variable inside a macro


How do I create variables inside of a macro? I've created a macro library with some macros and now I am trying to figure out how to create a local variable that exists inside a macro for the lifetime of the macro. Perhaps theres a way to store that data somewhere else?


Solution

  • While editing the Macro, use the Inputs collection of the Details panel to create a dummy variable of the required type.

    Do not check the By-Ref checkbox.

    Leave it unconnected when calling the Macro.

    Use the variable like any other variable.


    If you are not using latent functions like delay or timeline, use functions instead.

    I create function libraries anytime I need code reuse.