Why and what parent class to use with macro libraries?

A few weeks ago (engine 4.2) I added 2 homemade macros into the StandardMacros. The first one is a For Loop with a “step” entry pin that takes any int (+ or -), the 2nd is the same thing with a break entry exec. I added them to the StandardMacros because I know it is something that I will use often in many projects, and because I never created a Blueprint Macro Library yet, I have been lazy learning how to create one.

Now, I just updated the engine to 4.3, and it removed my custom macros from the StandardMacros. Ok, no problem with that, I will just stop being lazy and create a “CustomStandardMacros” library. So, when I want to create the library, I am asked to choose a parent class for it and I do not understand why.

My understanding is that a macro only contains non-compiled code that can be used in any context, and that the code from it will be compiled by the blueprint using it, whatever the type or class of blueprint it is.

So, I have 2 questions.

  1. Why do I need to choose a parent class when creating a Blueprint Macro Library?
  2. What parent class do I have to use if I want the macros in my library to run in any and every type of blueprints for the next 20 years without having to concern about it, the same way I do with the StandardMacros?

I don’t know why they changed it, but you can use the “Object” class as it’s parent class, so you will be able to use it within all other classes. If you use eg. the “Actor” class as it’s parent, you can only use those macros in classes that inherit from the actor class.

2 Likes

This makes sense. Thank you for your help.

Hmm, I can’t select ‘Object’:

I just tried to do this and ran into the same problem

You have to select Object as @Fluppi393 said.

http://i.imgur.com/ghpehHh.jpg

Why do I need to choose a parent class when creating a Blueprint Macro Library?

Unlike functions, macros are only valid in certain scenarios. For example, “Retriggerable Delay” cannot be used in a Macro Library for an Object because latent actions require an actor. (I’m still new, but I think this is correct.)

It’s also useful to limit the use of your macro libraries to specific types to reduce the noise in your add action dialog. There’s no point polluting it in a Pawn with macros for Controllers.

1 Like

Make sure you don’t have anything in the search box or you won’t be able to select “Object” for the parent.