Attaching a Blueprint to another Blueprint in Unreal Engine

- by

In a previous article I’ve explained how to put a gun into your character’s hand using the Attach Component to Component function. This works great if the component in question is a static or skeletal mesh, but it does not work for another blueprint class. Say you had a weapon and it has functionality, there’s no way to use the above class to parent it to your character. This is where Attach Actor to Component comes in handy.

We can’t call it in the Construction Script, so we’ll use Begin Play for this. Let’s stick with the “gun in hand” example, but now our gun is a Blueprint. We’ll still need a socket like I’ve explained earlier, but now we attach it like this:

Since we don’t have a reference in our viewport anymore, we’ll start by spawning our weapon blueprint, passing in the world transform of our current character. Note that this is different than the Spawn Actor at Location function. Next we’ll use Attach Actor to Component to parent the gun to the character, using the same location and rotation rules as before to make sure the mesh lines up with the socket. I’ll grab a reference to the gun while I’m at it, but that’s optional.

There we go! Now we know how to attach both a mesh and a blueprint.



If you enjoy my content, please consider supporting me on Ko-fi. In return you can browse this whole site without any pesky ads! More details here.

Leave a Comment