Adding a static mesh to a socket within a blueprint

I’m trying to create a construction script that allows me me to drag out my base mesh into the world, and through the Details panel, add additional parts to that base mesh by simply clicking on the file box and locating the mesh within the content browser.

I’ve already positioned the parts in my 3d modeling program, and also attached sockets to the parts individually within the mesh editor in Unreal. I can drag out the base mesh and then drag out the part I want to attach to it and right click > attach to > … and everything is just fine, but I’ve created a lot of different attachments for my base mesh and I want to set it up so that all I have to do is drag out one base mesh and go into the Details panel to adjust what parts I want to be added.

How should I go about this? I don’t know much about blueprints. I’ve tried adding Static Mesh Asset ID variables to my blueprint and adding my base mesh as the root component, and it lets me see and empty file box in the Details panel in the viewport editor, but when I choose a mesh, simply nothing happens. How do I apply the mesh I’ve chosen to visually (and physically, collisions) appear on top of my base mesh?

The construction script is only updated when the blueprint is spawned. So if you spawn the blueprint in instead of dragging it in it should do as you need. Set those variables to exposed on spawn = true in their details and the drop down will show up wheen you spawnactorfromclass.

basically you need static mesh components under your root static mesh, create a new editable Static Mesh variable, and then set those sub-static meshes in the construction script. You dont even need to set a mesh at first if you like and then set the mesh when you place the actor into the level. Just make sure the socket to attach is set in the details panel of the static mesh.

Then you’ll see the name and slot of the variable you created when you place the actor into the level.

Wow I’m too excited to even make sure it works as fully intended but I’ve got it working and from the look of it, it’s exactly what I wanted, thanks Jacky! I have one more question that would really top this off. Is there any way for the Asset selection box in the details panel to only search a specific folder?

I’d like to put multiple sockets onto my base mesh and ultimately have each socket with a variety of different options to choose from. However, the Asset selection box from the first socket displays my entire asset collection, so the only way to find what I’m after is to enter it’s name in the search box which might get kinda hectic. Is there any way I can narrow the selection down to a specific folder? Perhaps, redirect the variable to search for assets only in the specific folder. It would make it much easier because I’d like to create seperate folders in my content browser to house the parts for each socket.

So is there any way to redirect a variable or it’s selection box to a specific folder, instead of directly into the overall asset collection?

@Nsomnia
From my short experience, it looks like the construction script is always firing off from the moment a connection is made, but I’m not sure. I have gotten it working from Jacky’s suggestion though.

The only “easier” way i can think of is typing the name of the folder in the search bar so that it shows only the meshes in that specific folder. This also works with collections if you dont have the meshes grouped in separate folders.

Oh ok, that’ll work for now. Is there another way to achieve the asset selection searching specific folders automatically that perhaps isn’t easier, or you don’t think it’s possible at all?

I dont think there is any other way, unfortunately. : \ I was thinking about using an array and switching between meshes with an integer but that still requires you to select meshes for the array from the list first, so yeah, that’s a no go as well.

Oh well, maybe I’ll try suggesting a “set directory” feature for asset selection boxes or variables lol. Anways, thanks a lot!