Problem while exporting from Blender to Unity3D using a Python addon

Hello there,

I’m new to Blender AND to Python so it’s a double punishment I’ve got here. :evilgrin:

I’ve got a world map in a blender file and I want to export all the meshes (==countries) in independant files in order to access them with Unity3D (because in Unity, we can’t, by script, access the meshes from the imported .blend file)

Hopefully (?) I saw that Pjezek did a Github with an addon that do that export in separate fbx :
https://github.com/pjezek/blender/blob/master/unity_tools/init.py

He was very much inspired by this other addon for Unreal for which the coder did a very handy tutorial :

The problem is that I successfuly obtain the tab “Misc” on which the Unity Tools appears but when I click on “Batch Export”, there is that error that says actually nothing :

Traceback (most recent call last):
File “<blender_console>” line 8, in execute
Exception Blend file is not saved
location <unknown location>:-1

here’s a screenshot :


Can someone tell me what that error means ?
Thx

The blend file is not saved? Ctrl S ?

Thanks for your help!
You were right, that error came because the .blend file was not saved!

I did 2 other tests with .blend saved and it still didn’t work well.

First test, by batching the origin cube and 2 spheres I added (without a material). The only fbx saved after the batch with the unity addon was the one with the origin cube.

Second test with my map made by several meshes representing the countries.
I get that error :

Traceback (most recent call last):
File “<Blender_console>”, line27, in execute
File “C:Program Files\Blender Foundation\Blender\2.7.5\scripts\modules\bpy\ops.py”, line 189, in__call__ ret = op_call(self.idname_py(), None, kw)
RuntimeError: Operator bpy.ops.object.mode_set.poll() failed, context is incorrect
location: <unknown lication>:-1

I don’t think I’ll try anymore soon because i found a way, in Unity, to access all the meshes indenpendantly by using createAsset.
This allows me to save each meshes from the .blend file from the unityEditor , and it makes me be able to use them afterwards, on runtime.

But if someone get a solution about that new error, it could still be very handy.