How to export Blender model with all its animations to Unity?

Hello,

In Blender 3.5, I created a very simple character model with two actions, an Idle animation and a Run animation. When I try to export this to Unity as an FBX file, however, the FBX file only has the Run animation. I do not know why this is happening, and I would like to find out as soon as possible.

Here is the process of exporting it to Unity:

  • Holding down Shift, I select the mesh, then the armature. Both are selected, and the armature is the Active object.

  • I go to File → Export → FBX (.fbx). My export settings are shown here:

Does anyone know how to make it so my FBX has all of its animations included?

Well, I just exported now 2 animations. Had mostly default settings, pathway was: copy, no NLA strips, also selected only mesh and armature. My armature is the parent of all other things. I use older Blender version though.

Im having same issue if you ever found a solution… Thanks :smile:

I had the same problem, animations are only exported when they have very high position/rotation values, otherwise Blender does not recognize them as an animation if the Force Start/End option is unchecked.

9154727--1273034--upload_2023-7-18_11-25-58.png

but if you mark the force Start/End, you will be able to export all the animations, but there is a problem there, it will force and add keyframe of all the bones, if you use Humanoid in the animator it will work (but a bug in rotation bones), and if you use Generic in the animator, the rotations will work perfectly, however it is not possible to use avatar mask in generic and if animations are exported with force Start/End checked, all bones will have a keyframe and you will not be able to create animations on every part of the body in Generic.

My solution to all this was to create animations within unity with its own native animation tool, and with package animation rigger to facility.

I hope it’s not too late.
If you don’t want the process of manually exporting Blender to FBX, this is the solution.
(If you already have a bunch of blender files in your project,This solution may mess up your current project , so make sure you have a backup!)

1.Set the blender you want Unity to use as the default Blender file launcher for Windows (if you have multiple versions of Blender)

2.{The address where your UnityEditor was installed}\6000.0.30f1{Your UnityEditor Version}\Editor\Data\Tools\Unity-BlenderToFBX.py

Change the content to(Yes,Unity’s script for calling Blender is wrong, I don’t know from what version.)

def export_args():
    return {
        # These options seem to produce the same result as the old Ascii exporter in Unity3D:
        "axis_up": 'Y',
        "axis_forward": '-Z',
        "global_matrix": Matrix.Rotation(-math.pi / 2.0, 4, 'X'),
        # Should really be True, but it can cause problems if a model is already in a scene or prefab
        # with the old transforms.
        "bake_space_transform": True, <==These have been modified by me
        "apply_scale_options": 'FBX_SCALE_ALL',
        "use_selection": False,

        "object_types": {'ARMATURE', 'EMPTY', 'MESH', 'OTHER'},
        "use_mesh_modifiers": True,
        "use_mesh_modifiers_render": True,
        "use_mesh_edges": False,
        "mesh_smooth_type": 'FACE',
        "use_subsurf": False,
        "use_tspace": False,  # XXX Why? Unity is expected to support tspace import...
        "use_triangles": False,

        "use_armature_deform_only": False,

        "use_custom_props": True,

        "bake_anim": True,<==These have been modified by me
        "bake_anim_simplify_factor": 1.0,
        "bake_anim_step": 1.0,
        "bake_anim_use_nla_strips": True,<==These have been modified by me
        "bake_anim_use_all_actions": False,<==These have been modified by me
        "add_leaf_bones": False,  # Avoid memory/performance cost for something only useful for modelling
        "primary_bone_axis": 'Y',  # Doesn't really matter for Unity, so leave unchanged
        "secondary_bone_axis": 'X',

        "path_mode": 'AUTO',
        "embed_textures": False,
        "batch_mode": 'OFF',
    }

try:
    import bpy
    import io_scene_fbx.export_fbx_bin
    import sys
    argv = sys.argv
    outfile = ' '.join(argv[argv.index("--") + 1:])
    import math
    from mathutils import Matrix
    mtx4_x90n = Matrix.Rotation(-math.pi / 2.0, 4, 'X')
    class FakeOp:
        def report(self, tp, msg):
            print("%s: %s" % (tp, msg))
    kwargs = export_args()
    io_scene_fbx.export_fbx_bin.save(FakeOp(), bpy.context, filepath=outfile, **kwargs)
    print("Finished blender to FBX conversion " + outfile)
except Exception as e:
    print('error: io_scene_fbx.export_fbx not found.')

Have fun
:smiling_face_with_halo: :smiling_face_with_halo: