Global macro library: possible?

Talked about it on other thread but didn’t get to the bottom of this question, so I figured I’d make a specific one for it.

Is it possible to create a global macro library? and by global I mean really global, accessible within every single existing blueprint classes.

function libraries are global by default, so I’m not sure why macro libraries aren’t, and need to have a parent class.

I tried setting their parent class to “object” since it’s the top class on blueprint hierarchy, but apparently a macro library can only be accessed by the direct children to its parent class, not by children of children and so on. is that correct?

1 Like

Macro libraries are class dependent because they are not functions, just a solution for copy pasting big sections of code around the same class. To fit this criteria, they can call functions on “self”, which is the actor type the macro is defined for.

1 Like

right, but how come I can call macros like for each loop from within any blueprint class no problem?

default macros like that one are simply macros inside the “StandardMacros” library which inherits from Object.

If I make my own macro library and parent it to object, I actually can call its macros anywhere, but in this specific case of this macro I made, when I try to save the blueprint it returns an error.

This one works:

This one returns an error when saving a blueprint which is calling it:

hmmmm okay, never mind. The problem for some reason was that I copied and pasted that macro from another blueprint into the library, so I suppose it had “private objects” embedded into its nodes. Once I made the exact same macro from scratch it worked.

So if anyone comes across the same problem, YES, global macro libraries are possible, just parent them to Object and make sure you don’t copy and paste macros over.