How Do I Add a Component within a non-static, or static, method?

Hello,

I’m trying to add a simple component, any of them, to a method that is either static or non-static. I do not want to add components in a constructor like the documentation covers. I want to make a modular blueprint function similar to any of the “add X component” nodes that already exist. This leads me to believe a static method is the ideal choice.

There’s CreateDefaultSubObject(), but that only runs in non-static methods. So I try that. When I expose this method as BluePrintCallable and hook it up in the construction graph within a blueprint that derive from the method’s class, UE4 crashes 100% of the time

CreateDefaultSubObject() won’t run in a static method, so I’m not sure what to do as NewObject() isn’t working either.

I’m still new to C++. Any help is appreciated.

You cannot add components to non initialized objects.

Can you elaborate?