[Request] [4.12.5] Add BP node to add actor component of class

I am designing a project that involves modular actors that the user can change in game. When the user changes the parts to the actor, I need it to change functionality to it as well. Blueprintable components is a great solution to bundle functions together, but currently adding a actor component or blueprintable component to an actor through blueprint does not allow for an input node for a ActorComponentClass variable.

Adding a “AddActorComponentOfClass” node would benefit UE4 projects that use modular and procedural content.

There should be some CreateComponent-type node. Use that and pass it your class. It will return an object reference. You then use the AddComponent node of any actor and pass it your component.

Thanks for the reply, @Shohei,

However, I am still unable to find any kind of CreateComponent-type node that allows for a class to be passed through. Do you know the exact name of this node? I’ve searched through the possible blueprint actions with context sensitive unchecked and nothing shows up. Also, there is no AddComponent node that allows the user to pass in a component reference.

The only close thing I found would be “Construct Object from class”. This gives me a ActorComponent reference, but I get a build error saying "Wrong class to spawn ‘/Script/Engine.ActorComponent’

This is the best I can give you, and it is only targeted at the Windows platform. You can recompile it yourself if you want to export to other platforms. It adds a new node AttachComponentOfClass that will attach a new component to an actor (the component must NOT be abstract) and returns it.

Do let me know if you decide to use it or if you run into any issues.

Thank you for the plugin. This works perfectly without issue so far. I’ll have this in place until there is a fix for the ConstructObjectFromClass or the standard Add component allows it to pass in a class.

Sorry to wake up an old thread here but can you point out the blueprint node for version 4.19 to achieve this. Using construct object from class gives an error since I am trying to construct an Actor Component with it.