Can't import skeletal mesh, multiple root bones detected.

So i made a hands model in blender and did IK rigs for it. it works perfectly fine in blender and i can animate. However when i try to inport it into UE4 it said that multiple root bones where detected. UE4 supports only one. So i decided to parent the hand controller and pole ik to their corresponding bones but that caused the IK to stop working. What should i do to import my mesh into UE4?

Never export the actual rig to ue4 you must always create a clean fk rig that is being driven by constraints by the origanal rig. Make sure this new rig has one root bone always at zero space then select only the new rig bones and export those.

for your current situation dont touch the ik and ik nodes should not be exported just export the selected bone objects only with the root.

So when i export from blender should i only select the other bones and not the ik and pole target ones?

There’s a toggle in the FBX exporter to only export deforming bones, select that and make sure the IK bones don’t have deform enabled in edit mode.

I tried doing that and it worked! The only problem is that when i export animations for it it doesn’t work in UE4. The arms are under the floor in the animations preview and the animations doesn’t even play on them.

If you animate with IK and don’t export the IK bones with an actual IK setup in UE4 you probably need to bake the animation. You might want to create a copy of your animation so you don’t mess it up.

Basically, select the armature, do Bake Action (spacebar search or whatever), then check Visual Keying. The IK animation should be baked to your hand/arm bones. At this time the animation will likely look a bit crazy since you’re deforming it once with IK and one more time with FK. But after exporting it should look fine.

1 - Don’t rely on FBX to select the necessary bones, in this case the deforming bones toggle. It is never reliable and prone to problems.

2 - Most of the time you don’t need to bake anything with fbx export since it does that for you automatically (make sure to check “Resample all” in the animation parameters in order to bake keys on each frame, but if you are exporting directly from an IK rig and not a proper rig setup then yes you will run into issues sometimes if you use this method therefore:

3 - To avoid all the problems mentioned above do as I suggested and spare yourself future and current headaches by learning the process of a clean workflow. Create a fully exportable rig on top of your original rig, assign proper hierarchy parenting on this rig with a single root bone and then position/rotation constraint every single bone to its respective driver from the original rig. Then FBX export this rig with resample all checked. That should bake everything and export properly.

It’s 100% reliable if you utilize it correctly. What’s more is that the code for it is clearly visible, so anyone can access it and see this is a fact. If it doesn’t work for you, you are probably doing something incorrectly.

This is also incorrect. It actually reads the NLA strips / animation actions. If you have multiple things occurring at once and you do not bake your output won’t have a complete animation.

Really good tip, but if you aren’t baking before export your workflow could use some polishing.
especially when you start layering animation parts/poses to save time you will run into issues.

For the OP, the tip about using copy transforms is actually a really good insight.
While it’s not super easy to set up, it can allow you to ceate 2 entirely separate armatures and therefore enable you to export just the correct one with a couple clicks and completely disregards any other bones you might add to refine the rig itself (regardless of their deformation settings).

All that said I’m sure that we will start to see some improvements if not a complete rewrite of the FBX exporter in the short future after the 1.2m financing Epic just dropped on Blender Foundation.

meanwhile, the current code is not too horrible to understand… I mean if I could modify it and add in animation curve export and import, pretty much anyone else equally inclined on producing professional quality assets with Blender can do similar adjustments and finetunings…

for point 2: i did mention that if the user selects the original rig itself then yes you will run into issues, on the other hand if there is a proper setup for export it seems to bake it just fine, i am able to export complex rigs like this, but i do have custom scripts ready for baking just in case but so far working fine.

for point 1 maybe they improved it, but i grew never to trust it and always select bones manually for export. It only takes a click if the scene is well organized.

isnt fbx for autodesk? Not sure if the blender folks have legal barriers to modify it?

fbx is a file format. Anyone can modify any file contents as they see fit, so no there are no legal barriers what so ever to begin with.
On top of it Autodesk released all of the definitions and base code to manage/handle the format as open source, so technically its entirely possible to re-inplement the 2018 format exactly as its ment to be directly into blender.
The challenge is figuring out what goes where from the way blender builds things to the way the FBX builds things - and it’s quite a challenge because you can have so many Many different types of things.
lights, meshes, materials, armatures, etc. And that’s basically scratching the surface of what one needs to handle.

Also, selecting individual bones for export shouldn’t have any effect.
It’s selected Objects and a bone isn’t an Object in blender - ergo it should (because I dont remember if it actually does or not) not be taken into consideration and just export the whole armor object.