Fixed Blender 2.57 Import In Unity 3.3

Wanted to post what I had to do in order to allow Unity 3.3 to import from Blender 2.57. (Verified on OS X Snow Leopard 10.6.7, Blender 2.57, Unity 3.3.0f4)

I had to comment out some of the named parameters at the bottom of the following Unity python script:

Mac OS X: /Applications/Unity/Unity.app/Contents/Tools/Unity-BlenderToFBX.py
Windows:  \Program Files\Unity\Editor\Data\Tools\Unity-BlenderToFBX.py

...
io_scene_fbx.export_fbx.save(FakeOp(), bpy.context, filepath=outfile,
	GLOBAL_MATRIX=mtx4_x90n,
#	EXP_OBS_SELECTED=False,
#	EXP_MESH=True,
#	EXP_MESH_APPLY_MOD=True,
#	EXP_ARMATURE=True,
#	EXP_LAMP=False,
#	EXP_CAMERA=False,
#	EXP_EMPTY=True,
#	EXP_IMAGE_COPY=False,
	ANIM_ENABLE=True,
	ANIM_OPTIMIZE=False,
	ANIM_OPTIMIZE_PRECISSION=6,
	ANIM_ACTION_ALL=True,
#	BATCH_ENABLE=False,
#	BATCH_GROUP=True,
#	BATCH_FILE_PREFIX='',
	BATCH_OWN_DIR=False)
	# I don't think HQ normals are supported in the current exporter
print("Finished blender to FBX conversion " + outfile)

There may be a better way to fix this, but this worked for me in a pinch. Prior to this “fix” I was seeing the following types of errors in
Unity’s console and editor log file:

TypeError: save_single() got an unexpected keyword argument 'BATCH_FILE_PREFIX'
Blender could not convert the .blend file to FBX file.
You need to use Blender 2.45 or higher for direct Blender import to work.

There is a forum thread for this where Paulius from Unity posts, and includes a fixed script.

I had the same problem, but with Unity 3.4 and Blender 2.59.0. I’m on MacOS, but I believe the issues may be the same. There are varying arguments and cases defined in Unity-BlenderToFBX.py and where they eventually get handed off to a blender script called scripts/addons/io_scene_fbx/export_fbx.py (in a method called ‘save_single’).

Here is the relevant modified portion of Unity-BlenderToFBX.py, starting at line 53:

    ...
    io_scene_fbx.export_fbx.save(FakeOp(), bpy.context, filepath=outfile,
    global_matrix=mtx4_x90n,
    use_anim=True,
    use_anim_optimize=False,
    anim_optimize_precision=6,
    use_anim_action_all=True)
    # I don't think HQ normals are supported in the current exporter

    print("Finished blender to FBX conversion " + outfile)

I hope that helps.

As of Unity 3.5 (or at least the beta) Blender import has been fixed! :slight_smile:

How would we use it? I’m a bit lost…