I was making some Macros with arrays passed in using the Wildcard variable type. All is well until I tried to nest Macros, that is use one Macro inside another. I made a test project to showcase the issue.
Here are the Macros in question:
This one checks if an array’s length is over a certain value:
This one prints a debug message if an array’s length is over 5:
The issue is that when it’s used in a Blueprint, like this:
I get this compiler error:
(The type of Target Array is undetermined. Connect something to Length to imply a specific type.)
I’ve attached a zip of my test project: [WildcardBug.zip]
My guess is that the interior most Macro (in this case LengthMoreThan) is being inserted inside PrintThatArrayLengthIsOverFive, and when that happens it’s seeing the Wildcard type and not allowing it to continue to be a wildcard type, as it is in the definition for LengthMoreThan.
The work around is to copy and paste the contents of the interior Macro inside the Macro it’s being used in; but then that defeats the purpose of using a Macro in the first place, as you’re now duplicating code.
It would be nice if Macros realized when they’re being used in other Macros, and will just continue to use the Wildcard data type, instead of throwing a compiler error.
EDIT: Adding issue number: UE-21739 (Unreal Engine Issues and Bug Tracker (UE-21739))